Really the only thing we can say, is have a solid position. Once you can sit properly on your horse, in balance, not relying on the reins to hang on for dear life, or gripping tight with your knees to hang on, then you'll be in with a running chance of staying on. As you get more experienced at riding, you start to recognise the signs of when a horse is going to crack a tantrum on you and you can prepare yourself for the ride, or nip the problem in the bud before the horse goes off its rocker!
If you're falling off because the horse is bucking/taking off/shying etc., here's the best way I've found of getting the situation back under control. I learnt this one for internationally renowned biomechanics coach, Colleen Kelly, and by god, it works.
Forget a one rein stop that all the 'cowboys' like to push. If you whip a horse around in a tiny circle with it's legs crossing over you're pretty likely to flip the horse over on top of you. They are DANGEROUS! Instead, sit deep, take your inside rein and place it on the seam of your pants (so on your leg, just under your bottom ;) ). Look up, stick your feet forward with your heels waaay down, and then as the horse starts to spin, give a few quick 'come back' on the outside rein (don't hold the rein solidly, you don't want to make your horse rear).
I've ridden my fair share of lunatics that put on a fabulous aerial rodeo display, but haven't come off ONCE since I learnt this method, and have been able to defuse the situation easily.