Here’s the situation: You’re glued to someone’s wheel on a difficult climb, things start to get stretched out, gaps start to open, the guy you’re following starts to struggle, he then decides to stand up and put some umph into it. The first thing that happens is he initially loses 2km/hr, his bike is thrown backwards into your front wheel, your spokes nearly go into his derailleur, and then you’re the one left with a gap to close. Sound familiar?
When you’re on a climb and there’s someone on your wheel, you can’t just stand up and pedal in the same gear. What happens when you stand up when riding (especially on a hill) is you initially lose your cadence, you lose speed, and consequently you bike is thrown backwards a couple feet into the guy’s front wheel who is following you. It can be a heart stopping experience where many crashes occur. Most inexperienced riders do this as well as a surprising number of experienced riders.
What you need to do is shift up one or two gears (harder) just before standing up. Get on top of that gear and then stand up. This will prevent you from throwing your bike backwards into the guy behind you.
A tip on cycling etiquette is to wave your hand backwards to signal to the rider behind you that you’ll be standing up and might be slowing up a bit.