By stepping onto f8, Black’s king has just completed the three-piece kernel of a discovered check for White. The question is what White should do with his knight. The first choice is to use it as an aid to mate; but is mate within reach? Indeed, it is close by. White plays Nf5+, which seems to take the knight far from Black’s king but seals off e7 and g7—trapping the king on its back rank and preparing for a form of Anastasia’s mate. In reply to the check from White’s queen the king has to move (it is futile for Black to interpose his queen on d6):
If the king goes to e8, White mates immediately with Ng7. See how the rook on d1 plays a key role in sealing off the d-file.
If the king instead goes to g8, White plays Qf8+. This pretty much requires KxQ, dragging the king back to f8 and away from any possible flight square on the h-file. White then clinches the mate on the back rank with Rd8#.
If you are at a level of play where these materials are helpful, the sequence illustrated in these last two diagrams probably will have been challenging. It is worth playing over until it is clear. Again, the actual payoff if the whole thing is seen by your opponent will be something less than mate; Black will subject himself to one of those forks rather than the mate that comes if he avoids them.