It isn't pretty watching most golfers try to hit out of a fairway bunker. The problem is, they use their normal swing. If you drive with your legs on the downswing, like on regular shots from the grass, you sink in the sand and hit behind the ball. That's no way to get to the green.
Focus on two keys. First, stand tall at address and feel like you keep that height all the way through the shot. Second, swing a little easier and with less leg action (above). That will help you clip the ball off the top of the sand instead of driving down into it. If you do it right, you'll feel like your arms are swinging past your body through impact. A good swing thought is, More arms, less body.
One last thing on fairway bunkers: Take a club with enough loft to clear the lip in front of you. If there's no lip, take an extra club because you want to swing easier.
In greenside bunkers, I see a lot of players who try to flip the ball out with their hands. They stop turning the body and let the hands take over. Instead, think about making a full follow-through, with your chest facing the target at the finish. That will allow you to accelerate the club through the sand. Think finish, not flip.
Butch Harmon is a Golf Digest Teaching Professional.