The old puzzle
You stand before two doors. One leads to freedom; the other, let us say, to a very long detention with a tiger. Two guards watch you. One always tells the truth. One always lies. You do not know which is which, and you may ask exactly one question, to one guard.
Asking 'which door is safe?' directly is useless: if you happen to pick the liar, the answer points you to the tiger. The puzzle is to find a question whose answer is trustworthy no matter who hears it.
The question that untangles it
Ask either guard: 'Which door would the OTHER guard say leads to freedom?' Then walk through the door they do NOT point to.
It feels like a riddle wrapped in a riddle, but it works every time, whichever guard you chose. The next section walks through both cases slowly, because the 'aha' lives in the details.
Why it works
Suppose you asked the truth-teller. The other guard is the liar, who would point to the dangerous door — and the truth-teller honestly reports that, so you are shown the dangerous door. Now suppose you asked the liar. The other guard is the truth-teller, who would point to freedom — but the liar flips it, and again you are shown the dangerous door.
Either way, the answer has passed through exactly one lie, so it is always wrong in the same direction. Two wrongs do not make a right, but one guaranteed wrong is just as useful as the truth: simply do the opposite.

