Flying bugs often can't fly when their wings are wet. They go in for a drink, get wet, then can't get out. If there were some dirt on the edge, they could swim out and dry off, but a glass isn't made of dirt, so it's harder to get a grip on vertical glass or glazed drinkware.
Wine and sweet drinks are even worse, because the bugs are attracted to the scent, and they often don't have as much surface tension as water, which means the bug can't just land on it, and when they fall in the liquid fills their respiratory system (basically little holes in their exoskeleton).
For some insects it's part of their life cycle. They spend the majority of their life in a larval stage after being born in the water. Then one day they rise from the water as adults, fly around and mate , finally returning to the water surface to lay their eggs and expire. This is the basis for fly fishing. The angler has to present a fly that imitates the insect in the particular life stage that the fish are eating. Mayflies, midges, caddis and stoneflies are the most common insects. Nymphs, pupae, emergers, dun, spinners are the flies imitating the life stages.