These behaviors evolve as animals adapt to their social and environmental needs.