In some ways, SEMs work in the same way key copying machines work. When you get a key copied at your local hardware store, a machine traces over the indentations of the original key while cutting an exact replica into a blank key. The copy isn't made all at once, but rather traced out from one end to the other. You might think of the specimen under examination as the original key. The SEM's job is to use an electron beam to trace over the object, creating an exact replica of the original object on a monitor. So rather than just tracing out a flat one-dimensional outline of the key, the SEM gives the viewer more of a living, breathing 3-D image, complete with grooves and engraving.
As the electron beam traces over the object, it interacts with the surface of the object, dislodging secondary electrons from the surface of the specimen in unique patterns. A secondary electron detector attracts those scattered electrons and, depending on the number of electrons that reach the detector, registers different levels of brightness on a monitor. Additional sensors detect backscattered electrons (electrons that reflect off the specimen's surface) and X-rays (emitted from beneath the specimen's surface). Dot by dot, row by row, an image of the original object is scanned onto a monitor for viewing (hence the "scanning" part of the machine's name).
Of course, this entire process wouldn't be possible if the microscope couldn't control the movement of an electron beam. SEMs use scanning coils, which create a magnetic field using fluctuating voltage, to manipulate the electron beam. The scanning coils are able to move the beam precisely back and forth over a defined section of an object. If a researcher wants to increase the magnification of an image, he or she simply sets the electron beam to scan a smaller area of the sample.
While it's nice to know how an SEM works in theory, operating one is even better.