I suspect most of us learned the (prescriptive) rules in school. "Whom" is used when it is the object of a preposition or verb, otherwise "who" is used. There are some who say that "whom" is on its way to obsolescence. I don't go this far, because I can't believe that "To Who the Bell Tolls" will ever sound better than "To Whom the Bell Tolls", nor can I believe that "To Who It May Concern" will ever replace "To Whom It May Concern."
More complicated sentence construction requires more analysis, and therein lie the difficulities. Take this sentence: "Give it to whoever wants it." What is being said is, "Give it to the person who wants it." Hence, "whoever" is correct. "Whoever" is the subject of the clause "whoever wants it", so "who" is needed, even though the clause itself is the object of the preposition "to".
A Pat Buchanan column this week had a usage which is dubious. In a column discussing the possibility of Romney choosing Condi Rice as his running mate, he wrote, "Asked whom she voted for in 2008, Rice reportedly said, '...it was a special time for Americans.'" The "whom" here just does not sound right. After all, I have often been asked "Who did you vote for?", but never "Whom did you vote for?" If Buchanan wanted to insist on using "whom" here, he could have moved the "for" and made it "Asked for whom she voted in 2008..."
Another example appears in a recent devotional guide. The sentence reads, "Whom else would it make more sense to follow?" If we do the usual rearranging to to see if who or whom is correct, we have "It would make more sense to follow whom." But then, what about the "else"? It can't be rearranged to include the else, so we know something is wrong with using "whom" here. This is yet another example of going overboard in an attempt to be technically correct, and in the process spoiling the whole sentence, not to mention the whole thought.
When dealing with the written word we usually have the luxury of thinking through the correct usage, and re-arranging the word order if necessary to make it sound right, which the above writers failed to do. Speaking orally and off-the-cuff is more problematic. Best rule-of-thumb here is to use "who" if one is not sure, since a misplaced "whom" is much more grating that a misplaced "who".
Petition of the day
1 hour ago