From BEAM Robotics Wiki
Probably the simplest, reversible drive circuit is the H-Bridge. Some BEAMbots use H-bridge motor drivers; many more use an H-bridge variant of some sort. Here's a simple conceptual schematic:
A basic H-Bridge has 4 switches, relays, transistors, or other means of completing a circuit to drive a motor. In the above diagram, the switches are labeled A1, A2, B1, B2. Since each of the four switches can be either open or closed, there are 2^4 = 16 combinations of switch settings. Many are not useful and in fact, several should be avoided since they short out the supply current (e.g., A1 and B2 both closed at the same time). There are four combinations that are useful:
|A1 & A2||forward||motor spins forward|
|B1 & B2||reverse||motor spins backward|
|A1 & B1||brake||motor acts as a brake|
|None||free||motor floats freely|
As was alluded to above, more-sophisticated H-bridge designs can avoid "smoke" conditions that short out the supply current (though many BEAM applications do not require this).
H-Bridges are so common and useful that a number of commercially-available ICs are made that combine all the discrete components into a single package. These chips overcome many of the difficulties in designing an H-Bridge out of discrete components, and combine all of the discrete components into a single package that is often much smaller than could be accomplished otherwise. Of course, you also pay for this capability.