The pawn on h6 seals off g7 and thus traps Black’s king on the back rank. But a casual look at this position suggests that Black has himself covered: if White plays RxR, Black has QxR; if White plays QxQ, Black has RxQ—and either way the remaining Black piece prevents mate. The clue to White's solution is that Black’s queen and rook depend on each other. That means both pieces have a limited range of motion, and that White can experiment with putting pieces on squares that either of them are supposed to protect. So he looks for other mating ideas and thinks again of the pawn on h6. If White could put his queen on g7 he would mate there, so he starts in that direction with 1. Qf6. Black can only avoid Qg7# by playing QxQ, but then White mates anyway with RxR.