Check rule


If it is official blitz, then they point out the illegal move and claim the win. I still need to get the newest USCF rulebook but I believe you can just take the king as well in blitz. For other time controls, you take back the move, if possible to still move that piece legally you have to, and if not you can make a different move.

https://www.fide.com/fide/handbook.html?id=208&view=article
The rules governing illegal moves are in article 4.

You can’t even move your king in check, that’s the rule, but if it’s chinese chees, you move into check then you just in it, chinese chees has no rule about no moving in check but America does.

Here's the rule for both blitz and regular play from the USCF rulebook:
Blitz
A game is won by a player:
7d.)
Who, after an illegal move is completed by the opponent, takes the king (if the king is in check) or claims
the win and stops the clock, before the player determines a move and provided the player has sufficient
mating material as defined in rule 7c. A player who moves his king adjacent to the opponent’s king and
then attempts to claim a win under this rule based on the opponent’s failure to notice the check shall lose
the game.
Regular
11. Illegal Positions
11A. Illegal move during last ten moves.
If, during a game, it is found that one of either player’s last ten moves was illegal and neither player is in time
pressure (11D1), the position shall be reinstated to what it was before the illegal move. The players do not recover
the time used after the illegal move. The game shall then continue by applying Rule 10, The Touched Piece, to the
move replacing the illegal move. If the position cannot be reinstated, then the illegal move shall stand. Move
counters on clocks that have them may be readjusted. See also 11H, Director corrects illegal move in non-sudden
death and 16R, No time adjustment for reinstated position.
TD TIP: When the illegal move is a king left in check, special care should be taken by the director. All moves, not
just the first move, in which a player’s king remains in check should be regarded as illegal. That way, an illegal
move will always have occurred within the last half-move; therefore, players cannot argue that the illegal move(s)
should stand. Now, go back to the first illegal move that occurred (leaving the king in check). If the moves cannot be
reconstructed, go back to a position in which the king is in check, so that the king can get out of check. In
complicated cases like this the director has a lot of discretion. No player should gain an unfair advantage for
deliberate illegal moves, or for inadvertent ones, which were deliberately not pointed out. Remember that the clock
times will not be re-adjusted; however, move counters may need to be reset to the proper move number.
11B. Illegal move prior to last ten moves.
If it is found that an illegal move was made prior to each player’s last ten moves, the illegal move shall stand and the game shall continue.

You should move with the piece you have touched if you have any legal move with it, and also your opponent's time will increase as a penalty!

Thanks everyone, but I’m just a beginner and the answers are too involved for me. I should have specified that I’m discussing an informal situation where two friends are playing a fun game. When I inadvertently move my king into check, do I lose, or does my opponent points out that I have made an illegal move and tells me to put my king back and make a different move?

In that case, you can make up your own rule. You and your opponent just have to agree on it. Probably retaking the move is best, but that's only my opinion.