Plus one on the relaxing. It really helps with your wind and control of the bike. You'll waste a lot of energy if you get all tense in the body and/or grab the handlebars with a death grip. It's mental, too. If you tell yourself that climbing a hill is not fun, you'll believe it. I try to not to make a big deal of it and, next thing you know, I'm over the top. I've even gotten to the point where I given names to my favorite hills and treat them like old friends. I turn it into a fun thing, not a chore.

For my mountain biking, when climbing, I like to shift my weight and balance forward on the seat and get into a low forward crouch. That gives me good forward momentum and it also allows me to put more weight and strength into a stand, should I need to stand on the pedals. Standing on the pedals is easier with a mountain bike, of course, but still doable on a drop bar bike. As rebecca mentions, it's something you need to practice on a drop bar bike. Can feel pretty awkward, at first.

Timing of your shifting in mountain biking is hyper critical, less so on road riding, but still very important. Knowing when to shift really helps. Bad timing on your shifting can destroy your uphill momentum. Only way to learn this, though, is experience. No doubt about it, an experienced rider can get up a hill with less energy expended than a beginner and faster, too.