Where the pieces end up is the same as in normal chess.
Kingside (O-O): king on g, rook on f. Queenside (O-O-O): king on c, rook on d.
White uses rank 1 (g1/f1 and c1/d1), Black uses rank 8 (g8/f8 and c8/d8).
Neither piece may have moved yet. The king and that rook must both still be on their starting squares.
The way must be clear. Every square the king and the rook cross or land on must be empty,
except for the king and that rook themselves.
The king must be safe. It may not be in check, pass through a square an enemy piece attacks,
or land on an attacked square. The rook is allowed to pass through attacked squares.
Odd starts are fine. The king or rook may already stand on its target square, and the king and rook
may even swap places. If something is in the way, castling is simply not available yet.