They are either blown over on to their backs, in the case of beetles, but as for flys they have lost their balance and roll onto their backs.
If you lost your balance you would either go on your back or front.
Actually, they don't. But if you're referring to flies and other house insects, when they fall the legs act like the vanes on a dart that ensures the body usually falls down first.