Before we can say what the accelerometer of the iPhone does, we need to understand the basics of what an accelerometer does in general. The accelerometer is a device that can measure the force of acceleration, whether caused by gravity or by movement. An accelerometer can therefore measure the speed of movement of an object it is attached to. This is the job of the accelerometer in the Nike + iPod used in running shoes. The piezoelectric sensors can tell if the shoe they are in is moving (in the instant that it is not, the device shuts itself down) and, based on the amount of time the shoe is on the ground vs. the amount of time it is in the air, the iPod can convert this information into an accurate measure of the speed at which the runner is moving.
Because an accelerometer senses movement and gravity, it can also sense the angle at which it is being held. This is what makes the Wii work: Instead of a joystick, the user or player manipulates a controller (rather like a remote control). The controller contains solid-state accelerometers, which can sense the tilt, movement and speed being applied to them, as well as the direction in relation to the Wii's screen. This allows the player to use natural, intuitive motion. When you play, for instance, a sword-fight game, the controller is used as if it was the sword, with the movement translated into electric signals to the computer.
The use of the accelerometer in the iPhone is similar to that in the Wii, although on a smaller scale. The movement and tilt of the device is noted by the sensors, so it can tell which way the screen is being held. This allows it to automatically adjust the visual output to make it appropriate to the direction of the screen. In this way you can view lists with the screen held vertically and watch videos with the screen held sideways.