A bicycle in motion adjusts its center of gravity to remain upright. It's very similar to the inverted pendulum problem.
Look at a bicycle directly from behind with the wheels exactly lined up. Now imagine that you could frictionlessly slide the two tire patches left and right. The similarities to the inverted pendulum become more clear.
Of course, it is more complicated than the classic inverted pendulum. Instead of one point of contact under the mass, there are two. And the two points of contact (i.e. the wheels) have their own complex dynamics.
Having a rake angle on the front wheel makes a bicycle self correcting (if the c.g. is on the right side of where the wheels contact the ground, then a right turn is induced in the front wheel by the rank angle)
There are two major forces that must be in balance to turn a bicycle - the side force from being off center with respect to c.g., and the centripital force in the turn.
Ever watch a cyclist train on rollers? That's much closer to an inverted pendulum. And since there is no forward momentum, there is no centripital force, which makes it more difficult to remain upright on rollers than on pavement.