One way is through corners and free kicks.
The central defenders are often the best headers of the ball in the team, because they need to be able to defend crosses and long balls when defending. Because of this strength, they will often take a position close to the opposition goal for corner kicks and free kicks in the opposition half, and try to score a headed goal.
An example of this was the only goal in the world cup semi-final between Germany and Spain, scored from a corner by defender Carlos Puyol.
2010 FIFA World Cup knockout stage (Germany vs Spain)
As you suggest, this can be a risky tactic, and if the corner/free-kick is defended successfully, then the defender has to try to get back in position as quickly as possible, to prevent a successful counter attack.
A manager may decide whether the risk is worth taking, depending on the score. While in the lead, he may tell defenders to stick to their positions, but while losing, he may tell the defenders to be try and score a goal.