It happens so inconsistently and infrequently because it's something out of your control.
I wouldn't worry about the specifics; however, if you really wish to know: in this instance, your opponent was mashing the jump button because he was feverishly trying to get back on the stage. Jumping while you are on top of your opponent gives you a footstool jump, I'm sure you're aware of this. The neat thing about Spring Jump is that Sonic doesn't get interrupted from his ascent via normal means. Normally, you'd have to either grab him on the way up or straight up hit him with an attack that has knockback. It may also have something to do with Sonic being invincible on the first few frames but he can still be interacted with in certain ways that are beyond my technical understanding.
TL;DR you won't get better by understanding this particular mechanic. Focus your efforts elsewhere.