There is no "why" about it. Evolution, and science in general, aren't about "why" (at least not in the way you're using the word), they're about "what" (and by extension, "how" in the physical, mechanistic sense.) For "why", you have to turn to religion, mythology and similar lore, and/or fictional literature, though of course that's completely pointless on an "intellectual"/real-world level...The next step is, WHY
ETA: This is really more a "how" sort of explanation than a true "why", but in a sense, one could say that the reason "why" some animals developed wings was/is that before such creatures existed, "the atmosphere" was an under-, or completely, un-occupied ecological niche available for population by creatures appropriately adapted to it. And since there weren't any predators there yet, there was nothing except gravity and the inherent lack of a physical ability to overcome gravity that prevented creatures inhabiting it So with appropriate changes in animal physiology to allow them to do so (probably little by little), life forms that could not or might not have been able to survive long enough to reproduce in significant numbers on land or in the water could do so in the atmosphere, by avoiding being eaten at an early age by existing land- and sea-dwelling creatures that were faster or more powerful than them in those environments.
Even the slowest-flying bird, for example, can leave the fastest-running land animal in the dust, simply by flying above the dust and nesting in a place that the land animal can't find a foothold to climb up on to reach the nesting place... And even an animal that can, at first, only sort of "fly-hop" 20 feet up onto the face of a cliff, for example, will gain a significant survival advantage. And then eventually, a few of those animals will bear young that can "fly" slightly further and cling to vertical, or near vertical, surfaces more securely, etc, and so end up surviving to reproduce in even larger numbers than their ancestors, etc., etc...
ETAF: But on the other hand, the ability to fly, for example, isn't an end-all-be-all survival trait. Flight is very, very energy intensive, so not only must a flying animal spend a huge amount of its time eating, there must be enough food available for it to eat, and it should ideally (though not invariably) be relatively small, and must weigh comparatively little, compared to land and especially water-dwelling, animals relative to its volumetric size. So in places where there isn't significant "environmental pressure" to fly (because of a lack of predators on land), the ability to fly might be lost (or never fully develop), also due to natural selection, or in that case, the lack of selection for flight. Hence ostriches (and emus) or penguins, for example, which have their own unique characteristics that suit them to their environments, allowing them to flourish despite being unable to fly. (Ostriches are big, strong, and can run very fast, while penguins happily inhabit places utterly inhospitable to most other large animals, can swim very fast, and both stay underwater for extended periods and maneuver in it adroitly....
And fwiw, presumably a broadly similar process is what accounts for land animals too, for that matter, since the available evidence so strongly suggests that all life on Earth evolved from creatures that originally (many, many eons ago) lived exclusively in water...
Last edited: