Traditionally, two physics phenomena were considered necessary for keeping bicycles upright. Turns out neither of them are. And humans aren't necessary either.

If anyone had gone up to their physics professors a few days ago and asked what keeps bicycles upright, they would have gotten two answers; gyroscopic stability and the trail. It was presumed for some time that bikes managed to stay so stable while rolling down a road because the fast motion of the wheels gave the bike stability. If a force acts on the top of a spinning wheel, the wheel won't topple over. Instead, it turn left or right - turning along an axis perpendicular to the force applied. And so if someone riding on a fast-moving bike starts to fall sideways, the bike won't topple, it will turn into the fall and stay upright.

The 'trail' of a bike refers to fact that, if a vector were drawn that showed the applied force of the steering mechanism on the front wheel, that vector would hit the ground before the wheel does. Trace down the bar that goes from the handlebars of a bike to its front wheel - if you continue the line, it will always hit the ground in front of point where the wheel hits the ground.

If the force were applied behind the point where the wheel hits the ground, it would be a little like trying to steer a car with 'back wheel drive'. The trail keeps the bike upright for the same reason the gyroscopic effect does. If the bike tips to the left, the trail will force the bike to steer to the left. It will steer into the fall, get its wheels back under it, and stay upright.