You're a polar explorer and you've just reached the north pole. The huskies are yapping, the cameras are ready and you're just about to unfurl the flag when, all of a sudden, the north pole becomes the south pole. Imagine your chagrin.
Okay, so it doesn't really happen that fast, but it's true that in the past the earth's magnetic poles have switched places. In fact, it seems to happen roughly every 250,000 years or so.
How do we know this?
When lava is in its molten state, the atoms in it can move around fairly easily. At this time some atoms, like iron, will align themselves with the earth's magnetic field in a recognizable way. Then, as the lava solidifies into rock, these little compasses get frozen in position. It's like writing your name in wet cement.
Learning the direction
By calculating how old the rocks are where we find these ancient compasses, we can figure out how long ago the magnetized parts were locked in. That tells us which direction was magnetic north tens of thousands of years ago.
Surprisingly, it's not always the same as north is now. Occasionally the poles change places.
What is the reversal period like?
So, did the north pole drift slowly southward, so that at some point magnetic north was in, say Mexico city? No. The rocks tell us that, during pole reversals, there is a several thousand year period during which the earth's magnetic field is either gone or very much weakened.
At these times north and south become arbitrary terms. Eventually the magnetic field re-establishes itself, and it seems to be a matter of chance which side comes out north and which south.