Basically, there a two positions you can have when climbing a hill; seated, which is better for long distances and loose terrain, or standing, which is ideal for hammering up a short steep section. You should choose a position that is best suited for the length and type of hill.
You should try to get in the right gear before you start on your way up the hill. You can greatly shorten the life of your drivetrain if you shift on a hill. But if you absolutely have to shift, lighten up on the pedals for a second. This will give you a smoother shift.
When you're climbing a hill seated, shift your weight forward a little. This will keep you centered over the bottom bracket, which is a more efficient climbing position.
Keep your head low and close to your handlebars to prevent the front wheel from coming up and bouncing of the ground. If your front wheel is coming off the ground, you need to shift your weight forward a little more to keep weight over the front tire.
Don't pull up on the handlebars, instead, pull backwards with every stroke. This will help drive the rear wheel into the ground on every stroke, therefore preventing the chance of the tire slipping.
Keep your body relaxed during all climbs, with your shoulders square to the trail. When you tense up your muscles, you are actually wasting much of your bodies energy. You want to save as much energy as you can!