Does it Work?
There are many folk "remedies" for fending off pests, from brown paper bags to keep the bees away to deterring slugs and snails through the use of beer traps at the base of plants. The efficacy of the bulk of these methods is up for debate, and the practice of filling and hanging clear plastic bags with water to ward off flies is no different. The question of "how does it work" should essentially be supplanted with "does it work?". There is actually no empirical evidence fully supporting or entirely debunking the water-filled plastic bag theory; however, the following are the most popularly presumed theories on why it might work.
Video of the Day
Light Refraction Theory I
The most popular theory is that the refraction of light through the water in the bag confuses the flies in one of two ways. The first being that the fly sees its own reflection in the water, which is somehow frightening and/or confusing. This keeps it away from your doorway, and by extension, out of your house. While this theory is certainly on the inventive side, it doesn't entirely hold water, so to say.
Light Refraction Theory II
The second and slightly more plausible light refraction theory is that the light is refracted in a way that magnifies activity in the vicinity of the bag, and that this movement appears to be a predator, thus making the fly wary of the area. The plausibility factor is slightly higher for this theory, as it has a direct correlation to the fly's ocular physiology, relating to the fly's multifaceted eyes--though the theory remains unproven. In any event, many people swear by this method of pest deterrence, though science isn't entirely on the side of it being 100 percent effective.