I have found that in part, it's just luck. For example, if the horse spooks at exactly the moment when you are just rising from the trot, you are more likely to be knocked off by a sudden stop/spin. Especailly if the horse is a good stopper, like a cowpony type. But, since that has happended to me many times, I do realize that better balance is the only real "cure". Sitting up straight, not leaning too much forward, and keeping heels down and leg sunk down/long.
Some falling off is just par for the course, in my opinion.