This is among the most common of goal-scoring techniques when the ball's airborne. It looks simple to watch on TV, but it's not as a header can be mistimed, missed totally or the contact could made on the wrong side of the head.
How to head the ball right? - Focus & ensure you hit the centre on the ball with the front part of your forehead (above the eyeline and below the hairline, i.e. with a typical hairline & not a receding one :P)
Other points to be kept in mind while heading include: keeping the eyes open, having the arms out and one foot forward for balance.
An offensive header needs power, will need one to stand-up tall & timed to perfection for a goal. Christiano Ronaldo gets it right on most occasions - here's a compilation