There are pros and cons to most things people have suggested, but a lot of it comes down to knowing the horse you are on, and being good at reading the situation. The first and foremost thing to do is KNOW that you must get the horse’s feet moving. Rearing is usually just a really nasty way of saying “I WON’T GO FORWARD”, but it can be “I’m really, really scared…”
With that in mind, my first plan of attack is to take the decision out of the horse’s hands (or feet as the case may be!). If a horse starts to rear, I whip his head around to my knee and move his hind end off with my leg (kindly or with great vigor, depending on how entrenched and nasty the rear behavior might be). This serves two purposes: First, he is moving his feet and it is MY idea; second, a horse with his head to your knee can’t rear. We circle a few times like this, then I ask for FORWARD again. If the rear repeats, we repeat circling behavior with more vigor, for lack of a better word, and so on until FORWARD is achieved.
Eventually the horse will get tired of staggering around in a circle and decide that forward is easier than rearing or circling. And I won’t hesitate to use lots of voice and stick along with my leg if he insists on repeating the behavior. Rearing is nasty stuff and needs an appropriate response! And of course when they do go forward, that is no time to get picky about what speed or frame - reward forward even if it is the most pissed of spine jarring trot you have ever sat on.
After you know the horse, you can generally catch the rear before they even commit to it which is safer for all concerned.
If you REALLY know your horse, you might know he is the kind that will tolerate being whacked between the ears, and decide that a whacking is not worth the pleasure of a rear. I don’t particularly object to the hitting between the ears - I am no fan of rearing, and if it works on a particular horse, then more power to the person. What I am most concerned with is taking a willful horse with a bad behavior and turning him into a scared, defensive horse who flips over on said rider. That’s where the “know your horse” part comes in real handy.
When they are rearing, you do want to try to not overbalance them, hence the more forward seat with a following hand. That is just good riding and a strong dose of self-preservation!