Different bacterial shapes contribute to their adaptability and evolutionary success. For example, the spiral shape of spirochetes allows them to move through viscous environments, while the compact shape of cocci helps them survive harsh conditions. The ability to change shape, as seen in pleomorphic bacteria, enhances their survival under varying environmental stresses.