After you solve the puzzle, you can see why some alternate responses from white would have been worse. You can also see the move white should have made to avoid this position.
Note: I found this very nice tactic after the game in analysis. During the game, play proceeded much more messily.