There’s a grammar myth out there that no sentence should ever end with a preposition—along with an assortment of jokes about how someone who is supposedly uneducated responds to a snob and ends a sentence with an epithet to avoid this egregious error.
The problem is that there’s a bit of a misunderstanding about how this really works. Namely, every word that looks like a preposition isn’t necessarily one.
We all know some common prepositions:
in, through, during, on, beside, over, before
However, those words aren’t always what they seem. A true preposition links nouns, pronouns, or phrases to the sentence and tends to give a sense of where or when. When you use a preposition, you’re adding something to the sentence.
We went there.
We went there during the rainstorm.
In this case, the preposition during links the noun rainstorm to the sentence.
Often, however, some of the common prepositions can also be adverbs. Let’s look at before as an example.
He went before the tribunal. (preposition)
He went before. (adverb)
The difference is that the adverb before doesn’t link anything; it just tells when (i.e., modifies the verb).
There are other cases where a word that looks preposition-y isn’t really a preposition. For example:
I thought I would just drop in. (verb)
They should have just gone through. (adverb)
You’re most likely to see a prepositional “catastrophe” in questions because questions force us to reverse our normal order of things.
What are you waiting for?
In this case, for is actually a preposition linking what. In the regular form, this sentence would be
You are waiting for the train [or whatever the “what” is].
Strict grammarians might insist on a question like this:
For what are you waiting?
This sentence is accurate, but so what? The “correct” version should only be used in highly formal settings because it sounds formal. Anywhere else it just stands out needlessly.
My only note of caution is that if your sentence does end with something that either seems like a preposition or is one, make sure that the meaning is clear. Often those words are vague or imprecise by themselves.
Bottom line is that there are many more pressing issues than worrying about what your sentences end with.

I’d be interested to know your opinion on this:
Although “What are you waiting for?” is perfectly acceptable, it seems to me that “What” isn’t quite the right word, and makes the “for” necessary. Wouldn’t it be less clunky to write instead, “Why are you waiting?”
“Why are you waiting?” is actually a shade different in meaning. While it could and often does mean the same as “What are you waiting for?” (and it is a bit less colloquial), the latter can be used to suggest urgency or forcefulness.
For example, at the end of a movie, imagine that the hero sees his love interest in the distance, but he can’t bring himself to go to her. The hero’s sidekick asks him, “What are you waiting for?” The hero just needed that kick in the pants to chase her down. If the sidekick had asked “Why are you waiting?” the meaning is almost the same, but it just doesn’t have the same “stop sulking and move your feet” attitude.
But you’re correct. “Why are you waiting” is a bit more precise in most instances.
[...] words: coordinating conjunctions (and, or, nor, for, but), articles (a, the), as, to, and most prepositions—unless they’re the first or last word. However, the you-knew-it-was-coming exception is . . [...]
[...] already tackled ending a sentence with a preposition. So, today we take on split [...]
[...] Do you have any idea how excited I was when I read his blog the other day and he told me I can end my sentences with prepositions any time I want to? See! Look, I just did. And lightening did not strike me [...]