These words are often confused because of their similar pronunciation, because of a slight overlap in meaning, because both words act as verbs and nouns, and for reasons unknown.
Affect is usually a verb, commonly meaning to have an effect on something. This effect can be vague or indirect (Pollution affects everyone), or more immediate and emotional (The documentary affected us strongly). It can also mean to pretend or simulate (For visitors she affected an air of immense job satisfaction), and to wear or do something in an attempt to win admiration (He began to affect a silk cravat and an upper-class accent).
Affect as a noun is a technical term in psychology that basically means emotion. It is pronounced with a stress on the first syllable.
Effect is usually a noun meaning result, influence or consequence (The effects of video gaming on brain function). It can also mean a general impression (The cobwebs added to the spooky effect). It can mean a force or phenomenon in science or economics (Casimir effect, Doppler effect and so on). It can mean something being in force or in operation (The policy will come into effect next year; This medicine takes effect quickly). In the theatrical arts it can mean the smoke and mirrors part of production (inventive special effects), and in the plural it can mean one’s possessions or movable goods, generally in a formal context (Before evacuation they were instructed to gather their personal effects).
Effect as a verb has limited application, but you are likely to come across it occasionally. It means to bring about or to cause to happen, and it is often paired with change (The new board planned to effect significant changes in how the organisation operated). This usage is quite often erroneously encroached upon by affect, so it’s one to watch out for.
Most of these usages are quite familiar, though dictionaries differ over which to include and where definitions overlap. Some reference books include more obscure meanings or idiomatic definitions. The important distinction for most people to remember is that if A affects B, A has an effect on B. This local newspaper got it wrong:
So did The Guardian:
and this book on the Alexander Technique, by Sarah Barker:
And this edition of Generation X by Douglas Coupland: