The drill: look at any threats you can make with your pawns and ask what consequences would follow. It is especially important to consider this when the threatened piece has little room for escape. Here Black has the simple g7-g6, putting pressure on the queen. The queen’s freedom of movement is limited; it has to move to h4. Now what? Well, Black can attack it again: g6-g5, and now White is in a jam. To see why, consider his king; for it is affected by these movements of your g-pawn, which now seals off f4 and h4, and also protects those squares if you want to occupy them yourself. So look for your next check find Bxf4—mate.
This means that after Black's second push of the g-pawn, White wouldn't want to play Qh5. He would need to try f4xg5. That f4 pawn of White's becomes the evident obstacle to the progress of this combination for Black. But as we just saw, Black has a way to take that pawn out while making a threat: Bxf4+. That is the move to play, whether before or after the initial pawn push g7-g6. Whether White replies KxB or moves his king to h4, Black’s marching g-pawn then wins the queen. (Naturally you could have found the whole idea here by starting with the check Bxf4.)
A similar result can be reached by skipping Bxf4+ at the beginning and just playing 1. …g7-g6; 2. Qh4, g6-g5; 3. f4xg5—and now 3. … Bxg5 attacks and wins the queen. The bishop has protection against capture, and if White tries to move the queen to safety on h5, Black has f5-f4+. This forces Kh2, which in turn allows Black to play Rh1#.