With examples from Stargate SG-1 and House.
There are actually four related definitions at work here, two for each word. Things are confused further by the fact that each word has one definition as a noun and one as a verb, and the fact that all the definitions seem related.
We’ll start with the most commonly used and, therefore, most commonly confused.
verb. to to act on; produce an effect or change in
"I'm not sure I'm getting the right readings," said Carter. "Wherever this radiation's coming from, it could be affecting my equipment's sensors."
noun. something that is produced by an agency or cause; result; consequence
After the dust settled, Teal'c raised one eyebrow. "Was that this device's intended effect, Major Carter?"
(If you check out dictionary.com, you will see that this noun has several secondary definitions that turn out to mean very similary things: results, impressions, meanings, illusions—all things that are caused by something else. Incidentally, green_grrl remembers the spelling of this word in "special effects" because of the abbreviation FX, or "eff ex.")
Notice that the noun effect is actually used in defining the verb affect. This is how I remember the two: if you affect something, you cause an effect. The first (earlier in the alphabet) has to happen first, and the second (later in the alphabet) follows.
Unfortunately, that's not all for these two spellings. They each have one other major definition which has the opposite part of speech and a confusingly related meaning:
noun. an expressed or observed emotional response
"He has flattened affect," said Dr. Cameron. "The problem has to be neurological."
"Aww, he doesn't laugh at your jokes?" said House. "Maybe he just doesn't think you're funny."
Notice that this "affect" has a different pronunciation from the more common definition above! Its definition is also pretty specialized, so you probably won't hear, read, or use it very often.
verb. to produce as an effect; bring about; accomplish; make happen
Unfortunately, Teal'c's efforts to effect change in Jaffa society have been undermined by Gerak's demagoging.
Like the verb "affect" above, this means to change something. Like "affect" above, it is a transitive verb, meaning it has to take an object. The difference appears to be in what kinds of objects each one takes.
The verb affect is followed by the person or thing that is changed.
Cuddy hoped House's bedside manner wouldn't affect his results implies that she thinks House's attitude might not be good for his medicine.
The verb effect is followed by the kind of change itself.
Cuddy hoped House's bedside manner would effect results, on the other hand, implies that she thinks House's attitude helps his medicine.
The verb "effect" is also not very common. I see it most often in the context of institutions or organizations boasting about how excited they are about "effecting change."
To sum up, between these two spellings there are a total of two nouns and two verbs.
effect—something that is produced by an agency or cause; result; consequence
affect—an expressed or observed emotional response
effect—to produce as an effect; bring about; accomplish; make happen
affect—to act on; produce an effect or change in
The most important thing about this confusing pair is to that there is a difference. If you can remember what the difference is, you're a step ahead of many high school teachers and some college professors. But it's okay to have to check the dictionary every time, or keep this entry bookmarked so you can check it, or keep a Post-It Note on your desk to remind you. Always check, though, because using one where you mean the other can negatively affect (v.) your reader's affect (n.).
All definitions from dictionary.com