The expression "it's like learning to ride a bike" is often used in situations where you never really forget the lesson. Once you know how to ride a bike, that's it, you just know.
But while you may know instinctively how to ride a bike, you probably don't know the physics of it. For instance, you may not have noticed that when you ride your bike, in order to turn left you must first turn right, and in order to turn right you must first turn left.
First off, though we know more than a little of how bicycles work, we don't know the full story. For a time, following the first mathematical analysis in 1910, gyroscopic effects were presumed to keep a bike upright, and explain why bicycles can continue on their journey for a time without a rider. A century later a team took the trouble of creating a bike that counteracted the effect, in order to test it.
"The common view is that this self-steering is caused by gyroscopic precession of the front wheel, or by the wheel contact trailing like a caster behind the steer axis," the team wrote in their paper. "We show that neither effect is necessary for self-stability. Using linearized stability calculations as a guide, we built a bicycle with extra counter-rotating wheels (canceling the wheel spin angular momentum) and with its front-wheel ground-contact forward of the steer axis (making the trailing distance negative). When laterally disturbed from rolling straight this bicycle automatically recovers to upright travel."
So what keeps bikes upright, and going on a straight path? In short, we don't know precisely, but we know it's complex.
"A simple explanation does not seem possible," one review of the topic explains, "because the lean and steer are coupled by a combination of several effects including gyroscopic precession, lateral ground reaction forces at the front wheel ground contact point trailing behind the steering axis, gravity and inertial reactions from the front assembly having centre-of-mass offset from the steer axis, and from effects associated with the moment of inertia matrix of the front assembly."
Now let's talk steering. You may not notice it even as you do it, but in order to turn left you first turn your handlebars to the right.
If you were to be riding forwards and then throw your handlebars to one side suddenly and keep them there, you might expect to turn in that direction. If you do this, however, the direction you will soon be headed to is "groundwards".
"Centrifugal forces will throw your bike over on its side if you steer the handlebars in the direction of a desired turn without first leaning the bike into the turn," another paper explains. "Indeed, bicycle crashes are often caused by road obstacles like railroad tracks or sewer grates turning the front wheel and handlebars abruptly."
Instead, and without realizing it, people first do a small "countersteer" to in the opposite direction.
"One method of establishing the proper lean is countersteering, i.e., explicitly turning the handlebars counter to the desired turn, thereby generating a centrifugal torque which leans the bike appropriately," the paper explains. "Leaning the bike into the turn allows gravitational forces to balance the centrifugal forces, leading to a controlled and stable turn."
The paper lists other methods by which you can keep the bike stable during a turn, including thrust of the hips, lean, and pushing on one pedal harder than the other. However, they too came to the conclusion that the mechanism is quite complex physically.
"In any event, gyroscopic forces play little role in leaning the bike over, through they do help set the steering angle," they write. "The appealing notion that gyroscopic forces are central to bike behavior, often repeated in papers and textbooks, is incorrect."