“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 MC 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.” (Bothered by ending the sentence with a preposition? See my “Non-Errors” page.) “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?” 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. 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.