Lesson
White to move. Main line: 1. O-O#
O-O# moves the king to g1 and rook to f1. The rook immediately checks the black king up the open f-file. Castling is legal because e1, f1 and g1 are unoccupied and none of the king’s transit squares is attacked.
Black’s rooks on e8 and g8 and pawns on e7 and g7 occupy every neighboring square. The bishop on c4 controls f7, so the king has no downward escape, and no piece can block or capture the rook’s file check.
Treat castling as a rook move as well as a king move. Rare positions allow it to create a discovered attack or even mate; always verify castling rights and the three king-safety conditions before using the idea.