How is the Field Generated?
For an observer at the Earth's surface, the magnetic field is reminiscent of a permanent bar magnet whose poles are close to the geographic poles. Today the magnetic poles are about 11.5° away from the geographic poles. It is this difference that makes it necessary to set a correction on a GPS unit or a compass to account for the angle of declination (the azimuth of the horizontal component of the magnetic field) at your location. In the case where the magnetic and geographic poles coincide, which was most recently true in the late 1600's, the declination would be zero.
Consider a bar magnet
In order to build up a mental model of the Earth's magnetic field, let's start by considering a bar magnet like the one sketched below. You can also watch and listen to me draw a sketch of a bar magnet and there's a transcript of my explanation of a bar magnet's field lines.
This bar magnet is a good first order approximation of the Earth's field. Note that I drew the negative pole on top and the positive pole on the bottom. The pole that we call the "north" pole is actually a south magnetic pole because the north poles of magnets are attracted to it! At the poles, the strength of Earth's field is about 6 x 10-5 tesla, and at the equator its strength is about half that.
At the atomic level
Why does a bar magnet have a magnetic field, anyway? At the atomic level, all atoms have electromagnetic properties because the electrons orbiting the nucleus of the atom produce a magnetic field perpendicular to the spin axis of the electrons as shown in the sketch below. You can also watch and listen to me draw the sketch of the alignment of electron spin axes in a magnetic material as well as read the transcript of me describing electron spin axis alignment.
However, most materials, such as wood, glass, gold, or plastic have atoms randomly oriented so that the teensy magnetic fields produced by each atom cancel each other out. Some special materials like iron and magnetite are composed of atoms where the spin axes of the orbiting electrons all line up in the same orientation. These teensy magnetic fields add to each other and the result is a material that is permanently magnetized. The Chinese figured out thousands of years ago that if you heated iron above a certain temperature (modern science calls this the Curie temperature) and cooled it slowly you could form a magnet out of it. Above the Curie temperature, the iron is so hot that the atoms become disordered and vibrate about. Once the iron begins to cool, the atoms vibrate less and less and they lock into place in accordance with the field of the Earth. After the iron is cooled all the way, the orientation in which it cooled is "locked in." You can pick up the iron and wave it around, and it will still be permanently magnetized according to the direction it was pointed in as it cooled.
So, the Earth is basically a great big permanent magnet. But how does it sustain its own magnetic field? Several models were put forward as early as 1600 to describe Earth's field. One idea was that the Earth's core functioned as a big iron bar magnet, like the first sketch above. In fact, the field lines observed at the surface of the Earth don't rule out this possibility. However, the temperature in the core is hotter than the Curie temperature for iron. The Curie temperature for iron is 770°C, whereas laboratory studies estimate that the temperature at the center of the Earth is about 6600 ± 1000°C. Furthermore, the exact direction and strength of the field fluctuates over time (for example, right now the field is getting weaker and drifting to the west—recall this from Broad's article), and this would not happen if the core were permanently magnetized and stationary. Therefore, the model that best fits our observations of the field is that of a self-exciting geomagnetic dynamo. What this means is that the outer core is composed of an electrically conducting fluid whose motions produce a magnetic field. This model was developed in the 1940s by Elsasser and Bullard and refined in the 1970s by Parker and Levy. A sketch of a simple self-exciting dynamo is shown below. You can also watch and listen to me draw the sketch of the dynamo as well as read the transcript of the screencast about the dynamo.
The Earth is different from this simple sketch because instead of just having a metal disk spinning about an axis with a hole in the middle, the Earth's outer core is a hot convecting fluid. Nevertheless, the sketch does have a couple of important features that are consistent with Earth's field. It can work in either direction, and it sustains its own field through its rotation.
Typically textbooks will tell you to demonstrate magnetic field lines by sprinkling iron filings on a piece of paper and holding it over a magnet; the iron filings will orient themselves in the direction of the field lines of the magnet. This works if you happen to have a lot of iron filings at your disposal. If you don't, try this instead: Get a magnet and hold it up to the screen of your old picture tube TV set (you can do this with an old computer monitor too, but be careful because a strong magnet can play havoc with your hard drive). You should see rings of color around the magnet corresponding to the magnetic field of the magnet. This works because the way the TV projects a picture on to its screen is to electrify particular combinations of the red, green, and blue lights in each picture cell to create the image you see. If you get really close to your TV, you can see the picture cells. When you hold your magnet up to the screen you are basically overriding the magnetic field it was generating on its own.
Word of caution: Don't leave the magnet there too long or this effect can be permanent and you'll have to take your TV into a repair shop to have it degaussed. This experiment is best performed without any interested toddlers around to observe you!
Another word of advice: This won't work on any of them gol' durn newfangled LCD TV's. You've got to have an old one. What better use for an old tv set sitting around in your basement than donating its body to science, anyway?