One consequence of the Earth's internal structure is a magnetic field. A compass needle points roughly north. The standard 'lie-to-children' is that the Earth is a giant magnet. Let's unpack the next layer of explanation.
The Earth's magnetic field has long been something of a puzzle since magnets are seldom made out of rock, but once you realize that the Earth has a whopping great lump of iron inside it, everything makes much more sense. The iron doesn't form a 'permanent' magnet, like the ones you inexplicably buy to stick plastic pigs and teddy bears on the fridge door; it's more like a dynamo. In fact it's called the geomagnetic dynamo. The iron in the core is, as we've said, mostly molten, except for a slightly lumpy solid bit in the middle. The liquid part is still heating up, the old explanation of this was that radioactive elements are denser than most of the rest of the Earth, and therefore sank to the middle where they became trapped, and their radioactive energy is showing up as heat. The current theory is quite different: the molten part of the core is heating up because the solid part is cooling down. The liquid iron that is in contact with the solid core is itself slowly solidifying, and when it does so it loses heat. That heat has to go somewhere, and it can't just waft away unnoticed as warm air because everything is thousands of miles underground. So it goes into the molten part of the core and heats it up.
You're probably wondering how the part that is in contact with the solid core can simultaneously be getting cooler, so that it solidifies too, and be getting hotter as a result of that solidification, but what happens is that the hot iron moves away as soon as it's been warmed up. For an analogy, think about a hot air balloon. When you heat air, it rises: the reason is that air expands when it gets hot, so becomes less dense, and less dense things float on top of denser things. A balloon traps the hot air in a huge cloth bag, usually brightly coloured and emblazoned with adverts for banks and estate agents, and floats up along with the air. Now hot iron rises, just as hot air does, and that takes the newly heated iron away from the solid core. It heads upwards, cooling slowly as it does so, and when it gets to the top it cools down, comparatively speaking, and starts to sink again. The result is that the Earth's core circulates up and down, being heated at the bottom and cooling at the top. It can't all go up at the same time, so in some regions it's heading up, and in others it's heading back down again. This kind of heat-driven circulation is called convection.
According to physicists, a moving fluid can develop a magnetic field provided three conditions hold. First, the fluid must be able to conduct electricity, which iron can do fine. Secondly, there has to be at least a tiny magnetic field present to begin with, and there are good reasons to suppose that the Earth had a bit of personal magnetism, even early on. Thirdly, something has to twist the fluid, distorting that initial magnetic field, and for the Earth this twisting happens by way of Coriolis forces, which are like centrifugal forces but a bit more subtle, caused by the Earth's rotation on its axis. Roughly speaking, the twisting tangles the original, weak magnetic field like spaghetti being twirled on to a fork; then the magnetism bubbles upwards, trapped in the rising parts of the iron core. As a result of these motions, the magnetic field becomes a lot stronger.
So, yes, the Earth does behave a bit as though it had a huge bar magnet buried inside it, but there's rather more going on than that. Just to paint the picture in a little more detail, there are at least seven other factors that contribute to the Earth's magnetic field. Some of the materials of the Earth's crust can form permanent magnets. Like a compass needle pointing north, these materials align themselves with the stronger field from the geomagnetic dynamo and reinforce it. In the upper regions of the atmosphere is a layer of ionized gas, gas bearing an electrical charge. Until satellites were invented, this 'ionosphere' was crucial for radio communications, because radio waves bounced back down off the charged gas instead of beaming off into space. The ionosphere is moving, and moving electricity creates a magnetic field. About 15,000 miles (24,000 km) out lies the ring current, a low-density region of ionized particles forming a huge torus. This slightly reduces the strength of the magnetic field. The next two factors, the magnetopause and the magnetotail, are created by the interaction of the Earth's magnetic field with the solar wind, a continual stream of particles outward bound from our hyperactive sun. The magnetopause is the 'bow wave' of the Earth's magnetic field as it heads into the solar wind; the magnetotail is the 'wake' on the far side of the Earth, where the Earth's own field streams outwards getting ever more broken up by the solar wind. The solar wind also causes drag along the direction of the Earth's orbit, creating a further kind of motion of magnetic field lines known as field-aligned currents. Finally, there are the convective electrojets. The 'northern lights', or aurora borealis, are dramatic, eerie sheets of pale light that waft and shimmer in the northern polar skies: there is a similar display, the aurora australis, near the south pole. The auroras are generated by two sheets of electrical current that flow from magnetopause to magnetotail; these in turn create magnetic fields, the westward and eastward electrojets.
Yes, like a bar magnet, in the sense that an ocean is like a bowl of-water.
Magnetic materials found in ancient rocks show that every so often, about once every half a million years, but with no sign of regularity, the Earth's magnetic field flips polarity, reversing magnetic north and south. We're not sure exactly why, but mathematical models suggest that the magnetic field can exist in these two orientations, with neither of them being totally stable. So whichever one it's in, it eventually loses stability and flips to the other one. The flips are rapid, taking about 5,000 years; the periods between flips are about a hundred times as long.
Most of the other planets have magnetic fields, and these can be even more complicated and difficult to explain than that of the Earth. We've still got a lot to learn about planetary magnetism.
One of the most dramatic features of our planet was discovered in 1912 but wasn't accepted by science until the 1960s, and some of the most compelling evidence was left by those flips in the Earth's magnetism. This is the notion that the continents are not fixed in place, but wander slowly over the surface of the planet. According to Alfred Wegener, the German who first publicized the idea, all of today's separate continents were originally part of a single super-continent, which he named Pangea ('All-Earth'). Pangea existed about 300 million years ago.
Wegener surely wasn't the first person to speculate along such lines, because he got the idea, in part, at least, from the curious similarity between the shapes of the coasts of Africa and South America. On a map the resemblance is striking. That wasn't Wegener's only source of inspiration, however. He wasn't a geologist; he was a meteorologist, specializing in ancient climates. Why, he wondered, do we nowadays find rocks in regions with cold climates that were clearly laid down in regions with warm climates? And why, for that matter, do we nowadays find rocks in regions with warm climates that were clearly laid down in regions with cold climates? For example, remains of ancient glaciers 420 million years old can still be seen in the Sahara Desert, and fossil ferns are found in Antarctica. Pretty much everyone else thought that the climate must have changed: Wegener became convinced that the climate had stayed much the same, give or take the odd ice age, and the continents had shifted. Perhaps they'd been driven apart by convection in the mantle, he wasn't sure.