Flies are a part of life on this planet, as there are hundreds of thousands of species around the world. The common housefly (Musca domestica) is by far the most numerous. This is the species that most of us interact with on a daily basis and so this article will be addressing this one in particular.
House Fly
Bottle Fly
Horse Fly
Maggot

I live in an agrarian neighborhood, so during the warmer months flies are a constant problem around my house. When they are crawling across your face or in your food it's pretty disgusting to think about where they grow up, where they feed, and to what they are attracted. Some species actually carry and transfer diseases, fungi, bacteria, parasites, and viruses—none of which you want on you. Here is a short list: typhoid, cholera, dysentery, giardia, hepatitis, and salmonella. I have never been sickened by flies, but the potential is there. And preventing sickness is as good a reason as any to want to learn how to control flies.
Remove all food sources. As with most pests, the first step is to figure out why the fly has been attracted to your home. This is usually going to be because of a readily available food source. Different flies are attracted to and thrive in different environments. The kinds of flies that tend to be around my house live, eat, and breed in the filth inherit to farm life. But your situation might be different. In a more urban setting your source is more likely to be rotting garbage, dead animals, or pet feces. You need to inspect your environment, identify these food sources (inside and outside your house), and remove them.
Block flies from entering your home. Your first line of defense is the walls of your house. I happen to live in a house that was built during the McKinley administration. The foundation has some pretty big gaps in it and the wood siding is degraded, which makes it an easy entrance point for a number of pests (especially insects like Asian lady beetles and house flies). I am taking measures to remedy the situation by filling the gaps with canned foam. One could also use cement or caulking. Some other easy entrance points include: loose-fitting windows, screens with holes or torn seams, gaps around doors, open chimney flues, and non-screened vents in attics.
Fly tape will control flies. It's sticky, ugly, and hard to deal with, but it works. The thing about flies is that they fly like drunken idiots and given enough time they will inevitably fly into one of those sticky death traps. Our ribbons were completely loaded within a week. At this point you need to change the tape. You can make your own flypaper with this simple recipe: Mix a fourth cup corn syrup and two tablespoons of granulated sugar in a small bowl. Cut strips from a paper grocery bag and soak it in the syrup. Hang it up over a container for a few hours to catch the drips. You then use it as you would commercial fly strips.
Light traps are a good passive fly control. These are common in food service areas because they don't require any kind of poisons and they are self-contained (and therefore not a contamination hazard). They are kind of a cross between fly tape and the zapper. The fly is attracted to an ultraviolet light that is inside a triangular box hanging on the wall. The flies are funneled down inside the box where there is a sheet of sticky paper that you peel off and replace when full. These work well in places like kitchens, though they are sort of industrial looking and might not fit in with your decor.
Zappers control flies outside. I have fond memories of late-night gatherings at my great-uncle's house when I was a child. He had a hobbit hole that he used for potato storage and he had a bug zapper—both are prime sources of entertainment for young boys. Bug zappers work by attracting insects toward a light source and then surrounding that light source with enough electricity to fry an elephant. These devices will attract insects and kill them. However, the vast majority of the insects killed will be harmless pollinators—and this is a bad thing. So, keep that in mind.
Poison sprays are probably the first option for most people, but I am reluctant to use it in all but the worst situations. Fly control sprays aerosolize some pretty toxic stuff, so you need to be very careful. Don't get it on your skin and wash any food surface that comes in contact with it. Remember, you are going to be living with this stuff for a while; proceed at your own risk. Here are some basic safety tips for indoor application:
Outdoors? Poison sprays can be effective for controlling flies outdoors for a short period of time. The key is to spray an area on a calm day and to target areas that might attract or breed flies, such as garbage cans. The problem is—in my humble opinion—that you are not only killing flies, you are killing every insect, including beneficial insects like pollinators or predatory insects that would have likely killed some of the flies in the first place. Sprays of this sort are also toxic to fish and can kill plants if the poison is applied improperly.

Fly-repellent plants. You could fill your house with Venus flytraps (Dionaea muscipula) and, although it would look cool, you would not get rid of your fly problem. There are, however, many plant species that are said to deter flying insects like flies: pyrethrum, Kentucky coffee tree, black locust, shoo-fly plant, lemon basil, and citronella grass to name a few.

Scent traps. One of the more disgusting but effective fly control methods is a scent trap. The device consists of a half-gallon jar and a lid that is designed to allow flies into the foul smelling enclosure, but not let them out. You wouldn't believe how many flies we caught. Now if only it didn't smell so bad . . .

Fly swatters. There is something sickeningly sweet about swatting a bothersome fly. Flies are quick and can sense your hand coming seemingly before you think to move it. But by extending your hand you can increase your speed exponentially and eventually you'll win.