The check nobody sees comes from a long way away. Here White has just been hit by a bishop from a7, on the far side of the board, and is about to play a natural-looking rook move.
7
2
f
g Two legal moves. Every other rook move, every pawn push, everything else White might have been planning, is not a move at all.
An illegal move never stands
That is the whole answer. A move that leaves your own king attacked is illegal, so it does not change the position, whatever the clocks say and whoever noticed first. You put the pieces back and play a legal move instead. Nobody has captured a king, nobody has lost, nothing has been forfeited.
At home, take it back and carry on. That is not a favour, it is the rule.
One thing does carry over: if you touched a piece, the touch-move rule still applies, so if that piece has any legal move that deals with the check, you must play it. Reach for the rook, discover you are in check, and Rf2 becomes compulsory.
At the board with an arbiter
Article 7.5 of the FIDE Laws is the place where it gets expensive. An illegal move is completed once you press your clock. When that has happened, the position immediately before it is reinstated, and the arbiter adds two minutes to your opponent’s clock for your first completed illegal move. A second completed illegal move by the same player loses the game.
So the penalty is not for missing a check, it is for finishing the move and hitting the clock. In a scramble at the end of a blitz game, that distinction is worth a whole point. Rapid and blitz run under the appendices to the Laws and treat illegal moves more harshly than standard play does, so if you play them seriously, read the appendix or ask the arbiter before the round rather than after the incident. The illegal move page goes through the procedure and what to do with your hand off the clock.
Online it cannot happen
Every server checks legality before it accepts a move, so the piece simply refuses to go there and the clock keeps running while you work out why. Premoves get cancelled the same way. This is why players who have only ever played online are surprised by the whole subject and why the first over-the-board tournament is where they meet it.
Stop missing them
Missed checks are the same failure as hung pieces: you looked at your plan and not at your opponent’s last move. The fix is a two-second scan after every enemy move, along the lines and diagonals leading into your own king, and it is the first habit in how to stop blundering. Long-range bishops on a7 or h2 are the ones that catch people, because they come from squares nobody is looking at.