Any motor with a rotary output shaft has but one simple function: turn the shaft. This one function has two base parameters: speed and direction (rotationally being either clockwise or counterclockwise). In a DC electric motor, both of these two parameters are defined by the input voltage to the motor. For motors rated at 12VDC (volts, DC), to rotate the output shaft in the forwards direction, relative to the motor itself, at "full speed," you must apply +12VDC to it. On the other hand, if you want to rotate the output shaft at full speed in the opposite direction, you must apply -12VDC to it.

Now that we have a couple basic concepts, we can examine how this H-bridge system works. A typical DC electric motor has two terminals (the red terminal for the designated positive input voltage, and the black terminal for the negative or common ground). Direction of the current flow from the power source (most likely a battery) to the motor's electrical connectors determines the sign (positive or negative) of the input voltage to the motor.

"What does all of this have to do with an H-bridge?" You say? That's coming up, but until then, here's an introductory diagram:

This diagram displays the two main components in running a DC electric motor: the 12VDC power source (on the left), and the DC electric motor (on the right). Until the power supply runs out of power to provide to the motor, the motor will continue to spin its output shaft. If one were to break this electrical circuit by adding a switch, you can control whether the motor is being supplied power, or not, at any given time.

When the switch is open, the electrical circuit between the power source and the motor is broken, electricity cannot flow, and the motor's output shaft slows down, and eventually stops spinning due to internal friction. However, this still does not allow us to control the direction which the output shaft will be spinning. We can only decide whether it will be spinning. Here's a diagram of the way that you can control the direction (as well as the simple fact) that the motor spins:

Now, this may seem very complicated at first, but really, it's very much like the last diagram, but with that addition of a few more switches. Now, one of the first things that you'll notice (if you're versed in reading electrical diagrams), with this configuration, is the fact that it is quite easy to close a combination of the four switches which results in the power supply being shorted directly to common ground. This is one of the many very bad things you can do, when working with electronics, and can wind up releasing much magic smoke into the atmosphere (there's also the severe chance you might start a magic fire, as well). But, as long as we're careful as to which combination of switches we have closed at any given time, we have the ability to control the motor's output shaft's spinning direction. More specifically, in the previous diagram, if we were to close SW1 and SW4, the motor would spin clockwise (arbitrarily), while if we were to close SW2 and SW3, the motor would spin counterclockwise. The reason it would do this is that the voltage is being applied to the motor in reverse. As was said earlier, you must apply -12VDC to the motor to cause it to spin in reverse, but because of the fact that we don't have a -12VDC source handy, it's so much easier to apply 12VDC to the motor's negative terminal, and connect the motor's positive terminal to common ground (0VDC, relative to the positive terminal) to produce -12VDC.

With this basic theory of operation, you can do many neat and interesting things, with regard to how the motor is controlled. You can use all sorts of components, such as optoisolators, transistors (MOSFETs), etc., to create a system based on your needs (or wants).