A bicycle is a wonderful example of an object that's unstable at rest, but stable in motion. My other favorite example is a broom balancing upside-down on the palm of your hand. Let's take a moment to look at the broom because it will help to understand the bicycle.
With the broom exactly centered above your motionless hand, nothing pushes it to one side and it balances. It's in equilibrium-it experiences no overall forces. In principle, it can stay that way indefinitely, but in practice it never does. The slightest shift of the broom's center of gravity to one side and over it goes. Any disturbance that shifts the broom away from equilibrium gives rise to forces that push the broom still farther from equilibrium, so the equilibrium is unstable. Any object that has no base of support-the polygon formed by its contact points with the ground-has an unstable equilibrium and tips over when disturbed. That instability stems from the fact that its center of gravity always descends when it's tipped and it releases gravitational potential energy as a result. Potential energy-energy stored in forces-is so intimately related to the forces themselves that whenever an object can release potential energy by heading in a certain direction, it naturally accelerates in that direction.
So the broom is unstable in your motionless hand. But if you move your hand, you can stabilize the broom. You do this by endlessly moving your hand under the broom's center of gravity. If the broom starts to tip to the left, you move its handle to the left to place that handle under the broom's shifted center of gravity. In that manner, you keep returning the broom to its equilibrium. Even though the equilibrium is naturally unstable, you keep helping it out and make it dynamically stable-stable in motion.
Now let's shift to the bicycle. Like the broom, an upright but motionless bicycle is in an unstable equilibrium. If you're really skilled, you can balance it by shifting your weight around to keep the overall center of gravity above the wheels. However, there's a much easier way to balance the bicycle: drive forward! Once the bicycle is in forward motion, it steers automatically and places its wheels under the overall center of gravity. Unlike the broom example, where you have to think in order to push the handle under the center of gravity, the bicycle does this for you automatically. If the bicycle starts to fall over to the left, the front wheel steers left and the bicycle drives its wheels under the overall center of gravity. The bicycle returns to upright all by itself, even when you have no hands on the handlebars.
The automatic steering occurs for two reasons. First, there is gyroscopic precession that occurs when the spinning front wheel experiences torques from the ground. When the bicycle tips to the left, forces from the ground twist the spinning wheel so that its angular momentum shifts from leftward to rearward. This complicated precession effect causes the wheel to steer left toward the left.
But the more important source of automatic steering is that the tipped bicycle naturally flexes about its steering axis and turns its front wheel in the same direction as the tip. If you tip the bicycle left, the wheel pivots so as to steer the bicycle left. The fork and frame design are important to this effect. The tipped bicycle can reduce its gravitational potential energy by flexing and, as I mentioned above, this capacity to lower potential energy leads to forces that cause the tipped bicycle to flex. When you tip the bicycle to the left, it steers left and thus manages to reduce its gravitational potential energy-the bicycle's center of gravity descends slightly. Together with gyroscopic precession, this automatic steering makes the bicycle's wheels drive under the overall center of gravity so that the bicycle keeps returning to upright. So the forward-moving bicycle is like a broom with an autopilot and thus very hard to tip over.
Answered by Lou A. Bloomfield of the University of Virginia