Bacterial biofilms are surface-adhered communities or suspended aggregates of bacteria that have increased tolerance to environmental stresses and antibiotics. These biofilms can be harmful by causing diseases and can be beneficial by serving as commensals and having bioremediation and energy applications. Throughout the formation of a biofilm, bacteria utilize different appendages, such as flagella and type IV pili (TFP), to engage in various behaviors, such as motility, interaction with their environments or neighboring cells, and responding to chemical gradients. These appendages and their associated motor machinery then activate cellular responses that are primarily controlled by intracellular secondary messenger molecules, such as cyclic diguanylate (c-di-GMP) and cyclic AMP (cAMP). In this dissertation, we investigate the complex spatiotemporal interplay between appendages and secondary messengers in bacterial sensing systems during biofilm formation. We develop a new technique to image how appendage activity impacts motility in single cells in 3D at high time resolution for cells near a surface and reveal an unexpected taxonomy of appendage-driven surface motility mechanisms. We find that sensing generally involves a complicated network of events that span different length and time scales, where appendage activity and secondary messenger production are mutually coupled to one another to generate feedback circuits. These complex couplings between bacterial signals and responses can propagate across generations of cellular division in a kind of memory or communication between ancestors and descendants. We develop a quantitative framework with stochastic models to analyze these coupled spatiotemporal correlations and behaviors, and our results indicate a social dimension to the strategies employed by bacteria while sensing and colonizing a surface. Furthermore, we find that bacterial appendages, in addition to sensing and motility, can also influence metabolism and impact cell size homeostasis during biofilm growth. Our quantitative framework can be applied to other bacterial systems to understand how they utilize their cellular machinery for orchestrating different types of social cooperativity while utilizing different surface colonization strategies. With this framework, we can understand the foundational basis for biofilm formation in terms of the complex interplay across time and space between appendage activity and secondary messenger signaling in bacteria sensing systems.