Out of check
You may not leave your king in check, and you may not move into check. There are three answers: move the king to a safe square, block the checking line, or capture the checking piece. One of those has to be the move.
A knight check cannot be blocked, because a knight jumps over anything you put in the way. Against a knight, you move the king or you take the knight.
Move the king off the file
The queen on e5 checks along the e-file. Kf1 steps off it.
Block the rook check
The rook on e8 checks the king on e1. The bishop steps to e2 and closes the file.
Capture the checking rook
The rook on e2 is giving check and it is not defended. The queen takes it.
A knight check cannot be blocked
The knight on f3 checks the king on e1. No piece can stand between them. The king has to move.