I think it might be easier to present the failure diagrams first. There are two main failure diagrams.
If , then destroys the eye. Capturing at only allows to kill by a throw-in that leads to a false eye.
With the above failure diagram, it is now easy to explain this failure diagram. here is greedy, and is the correct way to kill. It transposes back to the previous failure diagram.
Note that must not be played at a, which I leave as an easy reading exercise.
Descending at is the correct solution. If tries to remove the eye, then and captures three stones and makes the eye.
and are miai for life, so Black lives.
The main line is this diagram. connects and allow to live, and both parties are happy. This should be what is played in real games.