One of the things that eventually drove me away from the Garden Web House Plant forum (GWHPF) was the way people posted the same questions there over and over. It wasn't the same person asking the same questions, obviously, but, you know, you see anybody asking something you've answered thirty times already for other people, and you start to wonder why people think it's okay to ask you to type out an answer for their problem for fifteen minutes, but it's too much trouble for them to spend three minutes searching the archives.1 Which leads to irritation.
And then my irritation would bleed through and I'd write subtly hostile, cranky responses, which would just convince the person asking the question that everybody in the Garden Web forums was hostile and mean.2 I suspect I started writing PATSP partly so I could have a place to link to for questions I'd seen a million times already, rather than spending half an hour answering them all over again from scratch.
By far, the most frequently re-asked question at the GWHPF went something like, HELP!!!1!!!1!! I just bought this plant and I don't know what it is but there are all these fruit flies flying around it all the time and this is the worst thing that has ever happened to me so please please please can somebody tell me what to do to make them all die because they are ruining my entire life!!1!!!!!1eleven!! (And yes, some of them were actually that dramatic. You would be amazed.)
So.

First, don't panic. Or, if you'd already started panicking, please stop, 'cause it's annoying to read anything with that many exclamation points.
Second: they're not "fruit flies," (Drosophila) they're fungus gnats (Bradysia). I realize you probably don't see a difference or care, but you have to know your enemy in order to defeat them.
Where do they come from? Most likely, they came in with a recently-purchased plant. If you haven't brought in a new plant, but you've repotted something recently, then your potting soil probably contains gnat eggs. Miracle Gro potting mixes in particular are consistently about 67% gnat eggs by weight,3 but gnats are a risk you take with any high-peat mix.
Why? I dunno. They just like peat, I guess.
What do they want? The adults lay eggs on wet soil, the eggs hatch into larvae, the larvae eat (mostly decomposing organic matter, not necessarily fungus per se), grow, pupate, and then they're transformed into beautiful . . . fungus gnats.4 Adults don't eat,5 so they don't live very long: they're focused on mating and laying eggs. Since the survival of the eggs depends a lot on moisture, adults are very interested in things that strike them as potentially wet. Which means that sometimes, they will try to fly up your nose or in your mouth. Also one will occasionally find them drowned in unattended cups of coffee, or hovering near sinks.
Are they hurting my plants? Probably not. The larvae are capable of feeding on the fine root hairs of plants, but even if they do, this would only harm plants that were very young or very weak. Living tissue is probably not their first choice anyway.
How do I make them go away? You have many options here, with varying levels of ease, expense, and effectiveness.
Personally, I would recommend either watering less often or doing a soil change. If the soil the larvae are in goes completely dry, they die, and then you don't have a next generation of adults. It may take a while, especially if you have a lot of plants, bring home new plants often, or have a lot of plants that will die if they get too dry, but if you're consistent and patient, it should happen.
Letting plants dry between waterings is what I personally do. I bring in new plants often enough that we usually have a few fungus gnats around at any given moment, but considering the number of plants here, a few is as good as none. And honestly, I kind of like them.6
Soil change can be thorough (shake off every bit of soil from the roots and replace with all-new soil from a brand-new bag) or partial (shake off some of the soil and replace it with a faster-drying mix, like potting soil cut with perlite, coarse sand, aquarium gravel, aquatic soil, etc.). Thorough soil replacement may be more stressful for the plant, but it should stop the gnats immediately, assuming the replacement mix is clean. Partial replacement is easier on the plant, but won't fix the problem as fast. Some of the old soil will still be there; it'll just be drying out faster.
Another option: sticky traps. I don't like sticky traps. They sound good in theory -- they're just pieces of yellow cardboard with adhesive on them. Gnats land on the cardboard and then can't fly away again, so gradually you wind up with fewer and fewer gnats flying around.
In my personal experience with sticky traps at work, mostly the traps stick to leaves and hands, not to bugs, and when they do function as advertised, you then get to look at a brilliant yellow piece of cardboard that's covered in dead insects, which . . . makes a statement, certainly, but I don't think it's going to catch on in New York.
Soil drenches are another option. If you're going to go this route, a product based on Bacillus thuringiensis ssp. israelensis, or "BT," is probably the way to go. Some brand names are Gnatrol and Knock Out Gnats; several "mosquito dunks" also use BT and can be used instead, if you don't find gnat-specific preparations.7 BT is a bacterium that produces a protein which screws up the larvae's digestive systems and kills them. It's organic and safe around people or pets. One may have to re-treat once or twice before the gnats completely go away.
Several people at Garden Web swear by the potato method, which is: slice a potato in half. Lay the cut end on top of the soil. The fungus gnat larvae will find the potato, get excited, and start chowing down. After a few hours, you can pick the potato back up, with all the larvae now on it, and throw it away. Or you can slice off a section and put it back on the soil again. I'm not sure this is sufficient to eliminate a gnat infestation all on its own, but it might speed up the process if you decide to reduce watering, and the more larvae you can get rid of, the fewer adults you have to see.
A simple and fairly cheap solution for small houseplant collections: spread a thin layer (maybe 1/4 inch or 6 mm) of coarse sand on top of the soil in your houseplants. The adults can't get through the sand to lay eggs, and the larvae can't get through the sand to become adults, so the problem disappears in one generation. Plants so treated will stay wet longer, since water will have a harder time evaporating from the soil surface, but I suppose one could always scrape the sand back off again after two or three weeks, if it's really a problem.8

Actual pesticides like pyrethrins, imidacloprid, etc. are not, I think, necessary, nor will most of them even be effective, either because of their targets (if the label doesn't specifically say it will kill fungus gnats, it probably won't) or their mode of application (pyrethrins have to make direct contact with an organism to kill, and break down quickly -- they're useless for a fungus gnat larva an inch below the soil). There might be a role for a soil drench of neem oil with dishwashing liquid, if you're going to insist on a pesticide, but I think the other methods will probably work just as well as poison, and some of them are very cheap and easy. I mean, technically, watering less often should save you money. Just not very much of it.
That's pretty much everything I know about fungus gnats and what to do with them. If there's something I haven't covered, or if there's something I did address that you think I got wrong, feel free to leave a question or comment. Alternate methods of dealing with fungus gnats are welcome too.
-