Bacteria have complex collective and individual behaviors. For example, bacteria can form resilient biofilms to colonize surfaces or, can become motile to look for greener pastures. These lifestyle transitions are controlled by sophisticated signaling networks that integrate many sources of information to adopt an appropriate response. When uncertain about the optimal strategy, bacteria often take advantage of stochastic molecular processes to generate nongenetic phenotypic diversity and hedge their bets. I will discuss how phenotypic diversity can help resolve a fundamental performance trade-off during chemotaxis to maximize the population fitness in Escherichia coli. I will also discuss how quantifying the metabolic cost of making a flagellum may help us quantify the fitness advantage granted by motility even with limited information about the bacterium ecology. Finally, I will discuss how stochastic phenotypic switching between motility and biofilm formation may play a critical role during infection of the human gut by Vibrio cholerae.