Lesson
White to move. Main line: 1. Qh7#
The pawn on g6 is the whole pattern. It defends h7, so the queen can land next to the king and cannot be taken — and the king has no way to escape a piece it cannot capture.
Every flight square is already gone, and Black supplied most of them: the rook blocks f8 and the pawn blocks f7, while the queen on h7 covers g7 and h8. The defender’s own pieces do half the mating.
This is why the g6 pawn is worth so much in an attack, and why giving up a piece to establish one is a standard idea rather than a sacrifice that needs justifying.
Older than the modern rules
Pedro Damiano published this pattern in 1512, a few decades after the queen and bishop got their modern ranges. It is one of the oldest named mates still taught, and it still appears in club games because the ingredients are ordinary.
The pattern is usually reached by force: a rook or queen is given up on h7 to pull the king out, or a pawn is pushed to g6 at the cost of a piece. Both look like sacrifices and are really just the price of the mate.
The pawn is the piece that matters
The queen on h7 is the move everyone sees. The pawn on g6 is what makes it legal to leave her there — it defends h7, so the king cannot take, and a piece that cannot be captured next to a king is usually mate.
Everything else is supplied by the defender. The rook on f8 blocks one flight square and the pawn on f7 blocks another, while the queen covers g7 and h8. Four squares, and Black provided half of them.
What to do with this in your own games
Treat a pawn reaching g6 (or g3 against you) as a serious event rather than a detail. Once it is there, every queen route to the h-file becomes a mating threat, and defences that looked adequate stop being adequate.
The corollary is the practical one: when you are defending, spend a move to stop that pawn or to give the king a flight square before it arrives, not after.
A pawn on g6 defends h7 — that single fact is the whole pattern.
A piece the king cannot capture, placed next to it, is usually mate. Check what defends it before looking for anything cleverer.
The defender’s own rook and pawn take away half the flight squares here. Count your own blockers when you assess king safety.
Source: Checkmate patterns — https://en.wikipedia.org/wiki/Checkmate_pattern
Source: Pedro Damiano — https://en.wikipedia.org/wiki/Pedro_Damiano