Who vs. Whom

Who, whoever, whom, and whomever are pronouns— words that take the place of a noun in a sentence.
Who and whoever are subjective-case nouns, which simply means that they are used as substitutes for subjects in a sentence.

For example:
He tells that story to whoever will listen.  Whoever is the subject of will listen.

Whom and whomever are objective-case nouns, which means that they take the place of an object in a sentence. Because of this, whom and whomever are often (but not always) found after a preposition (to, of, with, about, for, from, etc.).

For example:
The board will probably approve of whomever we select.  Whomever is the direct object, receiving the action “approve.”

Who/whoever and whom/whomever are used in two main functions:

Relative or Subordinate Clauses

In these sentences, who/whoever or whom/whomever introduce subordinate (or dependent) clauses – phrases that can’t exist without the rest of the sentence.

For example:
Salvador Dalí was an artist who took great delight in shocking his contemporaries.
“who took great delight in shocking his contemporaries” is the dependent clause – if you use it without the first part of the sentence, it will be a fragment: an incomplete sentence.
OR
You will meet with our senior engineers, whom you will meet later.
“whom you will meet later” is the dependent clause – if you use it without the first part of the sentence, it will be a fragment, an incomplete sentence.

Interrogative Pronouns (in Questions)
When used as an interrogative pronoun, who/whom usually begins a sentence.
For example:
Who left the window open? OR Whom is the teacher speaking to now?

To choose between who and whom: Is the word performing the action?  Use who.  Is it receiving the action?  Use whom.

Hacker, Diana. A Pocket Style Manual. Boston: Bedford/St. Martin's, 2000. Perrin, Robert. The Beacon Handbook and Desk Reference. Boston: Houghton Mifflin, 2003.