So what is it?
That's right - flies and gnats don't like wind, so if you can get air moving through the stable, it will encourage those bugs to move on outta there. The trick is that you want to create a steady breeze throughout the day. How do you do that?
Good air circulation through your barn begins with the barn's construction. Yes, if your barn is already built then you're probably out of luck on this front, but it's good information to know in case you ever build a barn from scratch. When building your barn, be sure to include large barn doors that can be fully opened. Maximize the number of windows installed - ideally include one window per stall. Additional measures, like vents under the roof or additional doors on the side of the barn, can help to bring more air into the barn.
During the summer, open up all of the windows and doors that you can. This includes the barn doors. Be sure that windows are safely secured and/or grated to keep your horse safe. If you're worried about leaving the barn doors open overnight because of the possibility of escaped horses, then set up a few lengths of rope or 2x4 wood lengths that can be placed across the doorway to keep the horses contained in the barn.
Even if you get a good current of air moving through the barn, it won't do your horse much good if it can't get into his stall. Stalls with more open construction, such as those that feature stall bars or grates on their top portions, naturally allow more air to circulate. To maximize air circulation in your horse's stall, consider using a stall guard or stall door grate so that your horse's door can essentially be open, allowing air to freely flow into his stall.
Fans can also help to circulate air in the stable, but be careful whenever using fans. Only use fans in your barn that are manufactured specifically for barn and outdoor use. These fans have fully enclosed motors, unlike fans produced for household use. Household fans have motors that can quickly become choked by the dust of a stable, which can cause their motors to burn out. If the motor burns out, pieces of that hot motor can drop down onto bedding, starting a fire.
In addition to only using fans made for barn use, be sure that all of your barn's wiring is up to code. Check that the outlets, the cords, and the fans themselves are well out of reach of a curious horse.
Do the flies have you and your horse down? Increase the air circulation through your barn and you should see a decrease in your fly problem.
Photo source: https://www.flickr.com/photos/olocaudigital/10106250405