Rules and notation
A king cannot step into check
Remove the captured piece in your mental diagram, place the king on its destination, and test that square for enemy attacks. A king cannot capture into check.
Worked example
Position in text
White to move. White: king e1. Black: king a8, bishop g3, rook f2.
FEN: k7/8/8/8/8/6b1/5r2/4K3 w - - 0 1
The bishop on g3 does not currently check the king on e1: Black’s own rook on f2 interrupts the diagonal. Kxf2 nonetheless fails, because the bishop attacks f2. Test Kd1 instead: neither the bishop nor the rook reaches d1.
A plausible mistake
It is not enough to ask which piece is checking now. A square occupied by an enemy is often guarded by another enemy piece, and a king move can uncover a ray previously cut off by the king itself.
Try it yourself
Position in text
White to move. White: king h5. Black: king a8, rook h8, rook h6.
FEN: k6r/8/7r/7K/8/8/8/8 w - - 0 1
White is in check. Can the king take h6? Find a safe move to the g-file.
Check your answer
Kxh6 is illegal because the rook on h8 guards h6 through h7. Kg5 is legal: neither rook controls g5, and Black’s king is too far away.