The Simple Rule: One is a verb, and the other is a noun
This simple rule holds most of the time, especially when you’re trying to avoid being too fanciful. Basically, you use affect as a verb (i.e., when you’re describing the act of changing or influencing something, such as “I was deeply affected by Robert’s actions”). Conversely, you use effect as a noun (i.e., when you want to describe the result of an action, such as “Robert’s actions had a profound effect on me).
John was brought on to play, and this affected the final result. (affected as a verb)
John was brought on to play. The effect changed the course of the game. (effect as a noun)
Sounds simple enough. What about the exceptions?
If you look up affect and effect in any major dictionary, you’ll see they’re both listed as both nouns and verbs, but doesn’t this violate the rule above? Well, yes it does. Fortunately, however, these uses are fairly limited.
Let’s start with the meaning of affect as a noun. It’s mostly obsolete these days and is only used in certain contexts, such as in psychology and philosophy. It’s basically used to describe the subjective aspect of an emotion or observable manifestations of a subjectively experienced emotion. You’ll probably encounter it most when you hear psychiatrists talk about people’s crippling affects.
Effect can also be used as a verb, but this doesn’t mean you can use affect and effect interchangeably. In fact, they have very different meanings and usages. When you use affect as a verb, you are describing how the subject is influencing something that already exists. Using effect as a verb differs in that it implies the subject is actually bringing about something that didn’t exist before.
Miriam effected changes in government policy. (These changes did not exist before)
Miriam affected government policy. (Government policy already existed, and Miriam influenced it)
The diplomat effected a settlement in the trade dispute.
These constructions are relatively uncommon and can be easily avoided when writing if you still struggle with them. Still, they are perfectly valid in English, and they will crop up now and then.