Your position:a is definitely the normal local move, and b is normally bad for territory. in this case B is too weak in the centre on the whole right side of the board, so b becomes viable and even good to settle quickly.
When kvasir says counter hane is strong, I think he is right when fighting for space in the centre. In this case the value is more about how to rescue weak stones without giving up too much. I.e. don't get cut off into a bigger weak group.
Sacrifice variation:Play 19 before 17 is of course better normally though perhaps it doesn't matter much here. It does lose a ko threat though.
is at K14.
This shape appears in joseki for both
3-4, low approach, shusaku kosumi 4-5, 3 space low extension, invasion, attach underneath
and
4-4, low approach, knight's move defense, 3 space low extension, invasion, attach underneath
The 4-4 variation is locally better for the 4-4 side, and I think the 3-4 variation is slightly better for the 3-4 side. It also seems slightly worse for B to have the stone high.
Tips on sacrifice- Only sacrifice when you are weaker locally. If you are stronger, you should make it difficult for the opponent to get anything. When weaker, generally consider sacrifice at one point to get stronger everywhere else if possible by focusing on the opponent's weakest point.
- Sacrifice to gain strength from forcing moves. This is important if you have other weak groups to save nearby.
- Sacrifice a group (generally on the side) which you have enough to support to counter-surround even if the opponent surrounds you. If the opponent can't even surround you and you simply save your weak group, that isn't even a sacrifice, as in your 3rd diagram.
- sacrifice tesuji only occur if the opponent plays weak stones to surround your weak group.
Sacrifice strategyIf you want to strategically lay traps for the opponent to get them to try to take your stones on too small of a scale, then defend your weak groups but not as solidly. Use this sort of extra large oogeima rather than one and two space extensions. Add flexibility to your group when choosing direction of play in fights elsewhere on the board to get strength in the direction of where your weak groups might have to escape to if threatened, I.e. counterintuitively at the least valuable escape point since that is where the attacker will push you towards. Or supporting cutting the opponent's attacks.
Of course, this won't help much if your opponent kills you despite your support or if you add another overconcentrated move to live. Speedy strategies require some skill to manage as they dont secure valuable connection/eyespace/territory as well, so the player must balance this aji with developmentinto the centre. The opponent may be content to use the aji to break into the centre potential with a strong group. This is what b is trying to avoid, compared to a which sacrifices your 4th line stone.
The reason you normally sacrifice the side for the centre is that although the centre isn't very valuable, it is still very open. If you can get many connected moves in a row, you don't need the small eyespace that the side provides and the opponent may also find it difficult to reduce. However to get this, you must have some kind of group on the side that you are sacrificing. If it is already dead, you can't get many forcing moves.