Why do flies fly in circles?
Flies use any object they can find as a landmark.


  The flies patrol well-defined airspaces underneath landmarks like lampshades. ... Male flies approach a landmark from below and, in the absence of other flies, settle to patrol an airspace close to the landmark. A second male approaching the same landmark chases, or is chased away by, the patrolling fly when it comes too close and may eventually settle to patrol 10–30 cm below the airspace occupied by the first fly. ... The position of male patrolling stations relative to the landmark suggests that females might arrive at landmarks from the side (and not from below, as males do), thus crossing the dorsal visual field of patrolling males.


Source: Jochen Zeil. The territorial flight of male houseflies (Fannia canicularis L.) Behavioral Ecology and Sociobiology. August 1986, Volume 19, Issue 3, pp 213-219