The English language often combines verbs with prepositions to form phrasal verbs, and its subject-predicate structure means that many sentences end naturally in prepositions. Yet students, children, writers, and anyone likely to use the language are sometimes instructed not to end sentences with prepositions.
This is bad advice that has been passed on mindlessly for centuries, and seems to have led to embarrassing levels of contemporary silliness. It is an example of what Joseph M. Williams called “classroom folklore”, and good writers generally have the good sense to ignore it. This spurious pseudo-rule – a “cherished superstition” in H. W. Fowler’s words – seems to have originated with John Dryden, and has echoed through the dustier halls of grammar guidance ever since.
If anyone tells you that you can’t end a sentence with a preposition, you can safely assume they don’t know what they are talking about. Make good your escape while they insist that they do know “about what they talk” – unless you’re heavily outnumbered, in which case things could get ugly:

If there is gladness in the madness, it lies in the many witty and imaginative retorts and plays on natural English syntax. There are amusingly overworked sentences that end in long processions of stacked prepositions:
What did you bring that book that I didn’t want to be read to out of up for? (parsed here)
and even more tortuously elaborate variants:
What did you bring that book that I didn’t want to be read aloud to out of from up for?
What did you bring that book that I didn’t want to be read to out of about Down Under up for?
There are charming lines like the following one from James Thurber’s Alarms and Diversions:
‘It’s a bad city to get something in your eye in,’ the nurse said. ‘Yes,’ the interne agreed, ‘but there isn’t a better place to get something in your eye out in.’
and a more familiar one, often falsely attributed to Winston Churchill:
This is the sort of arrant nonsense up with which I will not put.
Finally there is Morris Bishop’s witty poem ‘The Naughty Preposition’, which was published in The New Yorker on 27 September 1947:
I lately lost a preposition;
It hid, I thought, beneath my chair
And angrily I cried, ‘Perdition!
Up from out of in under there.’
Correctness is my vade mecum,
And straggling phrases I abhor,
And yet I wondered, ‘What should he come
Up from out of in under for?’
Bishop was Professor of Romance Literature at Cornell University, where he was also University Historian. He had a reputation for wit and scholarship, and a flair for limericks and mystique. He seems to have been prejudiced against elves, but who can blame him? At least he was not prejudiced against stranded prepositions.
For more on ending sentences with prepositions, I recommend MWDEU’s historical analysis, sane commentary, and sound advice.