Unfortunately its not always easy or possible to make every shot. Whether it be because you made a mistake, your opponent left you a tough shot, or just by chance you weren't able to pocket a ball there are often situations where playing offense is not the best move. In these situations its best to play defense and play what is called a safety. Some people try to discredit safties and say that real players don't play safe or that its a cheap way to play pool. This doesn't make a whole lot of sense since what sport is there that is all offense and no defense? As far as I know none exists and none should exist in the first place. Besides safeties add a whole new dimension to pool that really makes it a game about more than skill but also strategy.
A safety is a defensive shot thats goal is to limit your opponents options. The best safeties leave the cue ball so your opponent can't pocket any of his own balls on his turn. Other safties might leave a long shot on the rail or leave the object ball so it cannot be pocketed without a hard bank from its given position.
In the example above the cue ball is hidden from the one ball so the cue ball is in a safe position. This means that in order to hit the one ball the cue ball will have to hit a rail first which highly increases your chances of the other player missing that shot and either getting ball in hand or you'll get an open shot on the one ball.
The best time to play safe is whenever you feel like you can't run out all of your ball successfully. If that is the case its probably time to play safe and in the process either a) move your balls so you can make them or b) move his so he can't easily run out. Another reason you might want to play safe is because you could gain an advantage over your oponent. Let's say you have a difficult shot that you could make, but the rest of the rack lays tough, but if you had ball in hand the rack would be easier. If its possible to play an easy safety to get ball in hand, then playing safe is a great idea.