As with all things in life rid yourself of negative thoughts imagine yourself already at the top and concentrate on the 100m or so that lies before you, the mind will see this as a target and you'll think less about the pain in your legs, best to spend the first 10 minutes warming up and adapting to the gradient by twiddling a gear slightly lower than need be, once you feel the extra heat generated by the legs flowing up through your body its time to turn a bigger gear, concentrate on pulling down the diaphram to induce more air, at the slightest increase in breathing and heart rate ease of just a bit, by the time the top is just a few km away you'll have plenty of punch in the legs left, contrary to popular belief a harder saddle makes a climb faster failing that load your MP3 Player with Dido or Dire Straits, great stuff for getting you moving faster.
If you know the climb up Reigate Hill in Surrey well, multiply that by at least 20 for an idea of the rides round here and you'll realise strength of character and the will to succeed are what gets you to the top.