When is it good to have wings?
When you need to move a great distance in as short a time as possible with minimal risk.
Clearly wings would have enormous benefit at a time when you need to get far away from the nest really quickly, perhaps at a time when you believe the weather would be particularly favourable. This benefit increases exponentially when procreation is involved.
When is it bad to have wings?
Almost any other time.
Rain and wings just do not go well together. If you get hit by a raindrop while wearing wings you are basically stuck where the drop lands until it evaporates completely.
I rest my case.
- When you are under attack.
Agility, while wearing wings, just cannot be considered one of your evolutionary advantages.
- When you are trying to gather/carry food back to the nest.
Surely an ant trying to carry a piece of a leaf, however small, would consider wings a severe burden.
- When times are hard foodwise
The protein investment in wings would surely be better spent on survival when food is scarce.
- Encounters with birds suck
Wings make you incredibly easy to grab hold of in mid-air, unless of course you can shed your wings when stressed, and many ants can (while obviously butterflies and moths cannot).
Wings or No Wings?
Surely my arguments suggest that having no wings would be a serious advantage in almost any situation except on the rare occasion when you need to move a long way really fast. Clearly the ant has an amazing skill to only have wings when they are needed and not at any other time.
Added after a number of comments
You have to remember that much of an ant's work is maintaining the colony as a collective. Preserving its cohesion, feeding the young, caring for eggs. The whole point of having a colony is to have far fewer individuals spread out, in danger, gathering food. This is to reduce the risk of complete colony death, which is essentially the death of the queen and therefore the gene pool of the colony.
You have to look at each ant colony as a single individual when you look at them on an evolutionary scale. In this way the life or death of one, or even 1,000 ants is not important, it is the survival of the colony. From this perspective, wings are dangerous for all my reasons above. The only time they are of value is during diaspora and that is the only time ants have them, which I think is incredibly clever.
Evolving a detachable appendage to an ant is like humans evolving detachable breasts at menopause. An astonishing achievement even humans have failed to achieve.