Currently, there are three main factors thought to affect bicycle stability:
- Amount of front wheel trail (i.e., caster wheel design)
- Mass distribution in front of the front wheel steering axis
- Gyroscopic processionprecession
In a modern bicycle all three work together to allow a bicycle to automatically steer into a fall, thereby exhibiting self-stabalizing behaviour. This automatic steering behaviour would allow a bike to be stable on rollers or moving over the ground.
Because stability is achieved through the balance of multiple factors, too much of any one factor can make a design unstable (e.g., by over-correcting). Furthermore, not all factors have the same impact. Some factors in isolation may be enough to make a bicycle stable on its own in the absence of the other factors (e.g., mass distribution in front of the steering axis).
The existence of multiple factors also means that different stable designs can use different amounts of each factors. For example, in the 1940's randonneur bikes used a lot less trail, but added mass in front of the steering axis (i.e., front bags carrying gear) to create a stable bicycle.
MinutePhysics has a good short video breaking down the impact of these effects. I believe in most stable designs gyroscopic procession (3) will have the weakest effect.