This question is about standard games under USCF rules (if FIDE is different, I'd like to know). Say that one side makes an illegal move-specifically, castling through check. Neither player notices. Five moves later, the same side that made the illegal castle makes a now legal move to create checkmate. During analysis, the losing side recognizes that the castling was illegal. I believe that once the checkmate position is reached, it is too late to correct the illegal move, even though it is within the last ten moves. Is that correct? Would the answer be different if the checkmate was created using the rook that was used in the illegal castling?
The FIDE rules say this:
7.5 If during a game it is found that an illegal move has been completed, the position immediately before the irregularity shall be reinstated. If the position immediately before the irregularity cannot be determined, the game shall continue from the last identifiable position prior to the irregularity. Articles 4.3 and 4.7 apply to the move replacing the illegal move. The game shall then continue from this reinstated position.
So you can't claim an illegal move after the end of the game.
On the other hand, you can't checkmate using an illegal move:
5.1 The game is won by the player who has checkmated his opponent’s king. This immediately ends the game, provided that the move producing the checkmate position was in accordance with Article 3 and Articles 4.2 – 4.7.
I don't know about USCF rules, but I suppose they are similar.