“Whom” has been dying an agonizing death for decades—you’ll notice there are no Whoms in Dr. Seuss’s Whoville. Many people never use the word in speech at all. However, in formal writing, critical readers still expect it to be used when appropriate. The distinction between “who” and “whom” is basically simple: “who” is the subject form of this pronoun and “whom” is the object form. “Who was wearing that awful dress at the Academy Awards banquet?” is correct because “who” is the subject of the sentence. “The M.C. was so startled by the neckline that he forgot to whom he was supposed to give the Oscar” is correct because “whom” is the object of the preposition “to.” So far so good.
Now consider this sort of question: “Who are you staring at?” Although strictly speaking the pronoun should be “whom,” nobody who wants to be taken seriously would use it in this case, though it is the object of the preposition “at.” “Whom” is very rarely used even by careful speakers as the first word in a question, and many authorities have now conceded the point.
There is another sort of question in which “whom” appears later in the sentence: “I wonder whom he bribed to get the contract?” This may seem at first similar to the previous example, but here “whom” is not the subject of any verb in the sentence; rather it is part of the noun clause which itself is the object of the verb “wonder.” Here an old gender-biased but effective test for “whom” can be used. Try rewriting the sentence using “he” or “him.” Clearly “He bribed he” is incorrect; you would say “he bribed him.” Where “him” is the proper word in the paraphrased sentence, use “whom.”
Instances in which the direct object appears at the beginning of a sentence are tricky because we are used to having subjects in that position and are strongly tempted to use “who”: “Whomever Susan admired most was likely to get the job.” (Test: “She admired him.” Right?)
Where things get really messy is in statements in which the object or subject status of the pronoun is not immediately obvious. For example, “The police gave tickets to whoever had parked in front of the fire hydrant.” The object of the preposition “to” is the entire noun clause, “whoever had parked in front of the fire hydrant,” but “whoever” is the subject of that clause, the subject of the verb “had parked.” Here’s a case where the temptation to use “whomever” should be resisted.
Confused? Just try the “he or him” test, and if it’s still not clear, go with “who.” You’ll bother fewer people and have a fair chance of being right.