Anyway, the story goes like this:

You're on a gameshow, there are three doors to choose from, one of them has a prize behind it, the other two do not (or have crappy prizes as opposed to the grand prize.) Where the prize is is determined at random with each door having an equal chance of success. As such it doesn't really matter which door you pick because they all have the same odds, for the sake of simplicity, and thus not writing this out three times, we'll say you picked door number 1.

The odds are as follows:

There is an equal chance that it is behind each of the doors.

Thus:

1 chance it is behind door number 1, you win.

1 chance it is behind door number 2, you lose.

1 chance it is behind door number 3, you lose.

That adds up to three chances, one you win, two you lose, thus the very simple odds that there's a 1 in three chance you win and a 2 in three chance that you lose.Now, at this point you know for sure that one of the two doors you didn't pick doesn't have the prize because there is only one prize and two doors. One of those doors will be opened. It will not contain the prize. The door you picked will not be opened no matter what. Now at this point we don't know which place it is, but we do know that the odds of it being behind each door is the same, and we do know that there are two possible outcomes.

Now a 1/3 chance is the same as a 2/6 chance and it's going to be easier for us to consider the possible outcomes if we think of it as six chances, with each door having two chances.

Before I get to the odds, it's important to point two things out, the first is that if both of the chosen doors are empty there's an equal chance that they open either. If there were something funky going on I'd probably need something more complex than upping it to 2/6. The second thing is that, since they can't open the chosen door, if the prize is in one of the unchosen doors they have to open the other one, there's no choice involved.

So:

1 chance it is behind door number 1, and they open door number 2, you win

1 chance it is behind door number 1, and they open door number 3, you win

1 chance it is behind door number 2, and they open door number 3, you lose

1 chance it is behind door number 2, and they open door number 3, you lose

1 chance it is behind door number 3, and they open door number 2, you lose

1 chance it is behind door number 3, and they open door number 2, you lose

The odds haven't changed, if you add it up you'll still find that there's a 2/6=1/3 chance it's behind any given door. The odds you win are still 1 in 3, the odds you lose are still two in three.

Then they open door number two showing it is empty/contains a non-grand prize.

Now we have new information. We know that it wasn't behind door number two, so we can cross those off our list of chances.

1 chance it is behind door number 1, and they open door number 2, you win

1 chance it is behind door number 1, and they open door number 3, you win

~~1 chance it is behind door number 2, and they open door number 3, you lose~~

~~1 chance it is behind door number 2, and they open door number 3, you lose~~

1 chance it is behind door number 3, and they open door number 2, you lose

1 chance it is behind door number 3, and they open door number 2, you lose

We know that door number three wasn't opened so we can cross that off our list of chances.

1 chance it is behind door number 1, and they open door number 2, you win

~~1 chance it is behind door number 1, and they open door number 3, you win~~

1 chance it is behind door number 3, and they open door number 2, you lose

1 chance it is behind door number 3, and they open door number 2, you lose

What does that leave us with? Well, see for yourself:

1 chance it is behind door number 1, and they open door number 2, you win

1 chance it is behind door number 3, and they open door number 2, you lose

1 chance it is behind door number 3, and they open door number 2, you lose

So, three chances, count them up. One that it's behind door number 1, two that it's behind door number 3. Odds you win 1/3, odds you lose 2/3, if you get the chance to switch doors you could take it because you double your odds in doing so.

You still might lose because there is that one in three chance it was behind door number one all along, but it's twice as likely that it's behind door number three.

And that's how it works.

Another way of looking at it is that they opened door number two, so we only need to consider the possibilities in which they opened door number two because the other ones definitely did not happen, which leaves us with the same three chances, and thus the same odds.

Some people have real difficulty with this. Part of it is that they're not taking into account that their chosen door will never be opened, part of it is that they're not taking into account how the new information interacts with the odds (if it was behind door number three there was a 100% chance door number two would be opened, where if it was behind door number one there was only a 50% chance) part of it is that they think that if the two were equally likely to contain the prize at the beginning they ought to be equally likely at the end, and for some people it's because they think if there are two options (Aliens will invade at 12:56 this afternoon or they won't) the two options must be equally likely.

And, it should go without saying but sometimes needs to be said anyway, if instead of door number 1 you'd picked 2 or 3 the math would stay the same. Ditto if the opposite unchosen door were opened. If you replace every instance of "Door number 1" with whatever door you really chose, every instance of "Door number 2" with whatever door was really opened, and every instance of "Door number 3" with whatever unchosen door wasn't opened. It'll all come out the same way. You should switch.

But that assumes that the odds really are as stated in the problem, they will not always be. In fact, if memory serves, on the game show that gave rise to the problem it was more complicated than that.