Where insects go when it rains depends on how much rain falls and on the species of insect.
If the rain is light enough, many insects stay out and are unaffected.
If the rain is moderate, most insects adapt and seek shelter. Butterflies and many other insects find spots under flowers, leaves, branches, or other vegetation, cling to the spot, and use it like an umbrella. If they are small enough, they may take shelter in a bark crevice.
If the rain is heavy, insects that are more accustomed to dry land will cling to whatever shelter they can find. The heavier the rain, the more substantial shelter they seek so they are not knocked into the water. Even if they are dislodged, it is uncommon for insects to
drown because of heavy rain. Most are just displaced and then find themselves in new surroundings.
Small burrowing insects such as ants find air pockets in underground burrows, even during flooding and flowing water. They require very little oxygen and can survive for weeks using air pockets that are always available even in densely flooded areas.
Insects that frequent water more often, like water beetles and mosquitoes, can negotiate rising, flooding and flowing water with more ease and they simply go with the flow.