When you cannot possibly pedal seated anymore switch positions and stand. When you stand, stay low and even your weight out. You should have enough weight over your rear wheel so that it doesn't slip, and enough weight on the front to stop it from lifting, or wandering. Once your weight is evened out, simply hold your posture, smoothly changing the pressure from one pedal to the other.
When changing from a seated to a standing position, be sure to change to a higher gear, which will allow more power and efficiency. Running a low gear while standing will waste too much of your energy.
EXTRA POWER WHEN STANDING:
On the steepest of climbs, many riders use a pulling technique to force more power into each stroke. On each downstroke use your arms to pull your body down towards your handlebars. This will assist your leg in compressing the pedal, therefore adding more power to your downstroke.
To conserve your energy always stay relaxed. Don't tense up your face and upper body on a climb. Keep everything loose in order to save your energy. Concentrate on your breathing, and create a rhythm of hard and steady breaths. This will prevent shortness of breath from occurring.
Most of the time when an average rider stands up on a climb, it is a signal that he/she is struggling and about to slow down. Let this be your advantage. Put the pressure on by keeping right up to them. Its mostly a mental game. If the tiring rider thinks you are still going good, they'll most likely slow down even more, giving you the chance to pass.