A legal move must keep your own king safe. Kings cannot stand next to each other. You win by checkmating the king, not by capturing it.
Castling moves your king two squares toward a rook, then places that rook on the square the king crossed. Neither piece may have moved, the path must be clear, and the king cannot start in check or cross or finish on an attacked square.
A pawn reaching the last rank promotes to a queen, rook, bishop or knight. En passant is available only immediately after an opposing pawn advances two squares and lands beside your pawn on its fifth rank.
Stalemate is a draw: the side to move has no legal move but is not in check. Other draws include dead positions and agreed draws. Threefold repetition and the fifty-move rule can be claimed; fivefold repetition and seventy-five moves are automatic, with checkmate taking precedence.