If you have put yourself in an undesirable situation, but are lucky enough to have a shot out of trouble, be sure to weigh your options. Getting out of trouble always involves a risk assessment. In most cases you want the best result with the least amount of risk, for others you can decide for yourself if the risk may be worth the reward.
The things to look for:
How likely are you to get solid contact from your current lie? Will the ball fly at a different trajectory (high /low) because of my lie? Is the grass likely to snag my club and turn it coming into impact? Will I need more club? Can I work the ball from this lie? How likely is it that the ball will stray from my intended line because of my lie?
2) Your situation
How far is it to the hole? Where is the trouble you wish to avoid? Where is your intended target and how much room is there for error? Are there any other escape options with a better chance of success? How confident are you with your ability to work the ball?
Take for example the picture shown here, the pin is directly behind the tree about 50 yards away. The way I see it, I have four options.
Red route option, is the least desirable is it puts me into a bunker, or worse having to play over the bunker on my next shot and it has a really low chance of getting the ball onto the green.
The yellow route option is the most sensible as it gets me out of trouble in one shot with minimal risk and chance of error. It also puts me in good position to get up and down. Only downside is it will likely take me three or more shots to get in the hole.
The green route option is a low running shot that goes under the branches of the tree. This option has a very slim margin for error, as distance control, the effects of the ball bouncing through the rough and potentially the tree all come into play.
The blue route is the final option, a flop shot over tree, but this route depends largely on your lie in the rough, if you can get the ball up fast enough to get over the tree, and finally distance control. One advantage for this shot is it allows you to aim for the flag, and also, if successful gives you the best chance of a lower score.
Each time you have a trouble shot you need to assess your options and choose the route which you feel will give you the best chance at saving strokes. Always ask yourself, is the risk worth the reward?
One more thing to always consider when trying to get out of trouble, which most amateurs ignore, is to simply advance the ball far enough to have a full iron into the green. The general consensus is to swing hard and advance the ball as far as possible. For trouble shots, swinging hard rarely produces success; simply advance the ball into a position where you have the best chance at success.
Remember golf is not a game of perfect, and there are no pictures on a scorecard.