Let's see...
There is a "safety" or "defensive shot" and then there is a "shot safety".
Basically when you do not have a good or easy shot, you can leave the cue ball in a nasty spot so your opponent does not have an easy shot. Or you can knock a ball or several balls into a situation where they are more difficult to play or they wind up blocking the path of the cue ball, so your opponent does not have an easy shot.
You are leaving your opponent with no shot or only a difficult shot. You are hoping that after your opponent shoots, he will give you an easy shot.
With some games/rules, you need to first hit your object ball or the proper object ball, then drive a ball to the rail. Not doing this entitles your opponent to ball-in-hand. This means your opponent can place the cue ball anywhere on the table.
So if you shoot a shot which leaves the cue ball in a very nasty spot - say hidden behind a ball, which he can not legally hit, then your opponent does not shoot a legal shot, this gives you ball-in-hand and a big advantage.
Bar pool rules are not typically ball-in-hand BTW.
With a shot safety, you might not call safety, but will attempt to make a difficult shot, and at the same time you will leave the cue ball in a good spot for your next shot, but a nasty spot for your opponent. So if you manage to pocket your ball, you can continue playing. But if your ball does not go into the pocket, your opponent will not have an easy shot or will have no shot at all.
Also if you call a safety, you can not shoot after your shot even if you pocket a ball. In other words, your opponent *must* shoot next after you call a safety. You can use this to advantage by calling a safety, shooting in one of your balls and at the same time leaving the cue ball in a nasty spot. Then your opponent misses his shot and gives you ball-in-hand. Next you can shoot another shot, first calling safety, and snooker him again. Then get ball-in-hand again. Safeties can go a long way toward helping you win a game.
There are some money tournaments which do not allow safeties. The better players will make it look like they are trying to pocket a ball, then will be way off, and say "how did I ever miss by that much?". "Oh my!" Then you will notice that the cue ball is in a nasty spot or the only shot you have is to shoot in one of your balls which is blocking his ball(s). It was a safety, but can pass as an attempted shot. When I play these guys, I accidentially miss my shots and seem to knock my balls into a position which blocks their balls. Again, not a safety

I just missed my shot is all! These guys like to dish it out, but can't take it. They get really ticked if you play the same way they do. (If my opponent is not playing any safeties in these tournaments, then I don't either.)
Also there is an "intentional foul". Say your opponent snookers you and you are not likely to be able to make a legal (good) hit. Well you are going to give him ball-in-hand anyway, so might as well do as much damage as possible before giving him ball-in-hand. Shoot one of his balls into a nasty spot or cluster, or shoot the 8/9 ball into a nasty spot.