When it rains, most flies hide in any small sheltered spot where they are protected and out of the rain. Some tiny or very large types of flies may continue to fly.
According to The Straight Dope, flies shelter under leaves, in crevices or in other small, covered locations. They often seek places that are protected from the wind as well as the rain. Very large insects often continue to fly around during inclement weather because the raindrops are too small to knock them out of the air. According to BBC Nature, very small insects, such as mosquitoes, are capable of flying through raindrops without causing them to splash.