When you first started learning to play chess, you were likely instructed to castle early -- perhaps as early as on the fourth move of the game. There's really nothing wrong with this approach; it is extremely safe, and allows novice players to play good, long chess games without worrying about getting checkmated in the first ten moves or so of a game. Essentially, you're taking safety over the prospect of getting the maximum advantage in the opening.
However, as you improve, you'll begin realizing that taking an overly safe and conservative approach to the opening isn't going to carry you very far, especially when you start playing against opponents who don't often make major blunders you can exploit. At some point, you'll need to start choosing when to castle based on positional considerations rather than rote memory.
If you're studying openings, you'll sometimes get lucky enough to know when to castle due to the fact that castling may be part of the opening theory you've memorized. However, if you're not studying openings that deeply, or you've left the book, you'll need to make your own judgment on when and where to castle. Here are a few quick tips that can help guide the way.
- If the center is open, or appears to be ready to open (for instance, if central pawns look likely to be exchanged), it's probably time to get your king out of there. A king sitting on an open central file is often as good as checkmated.
- Conversely, if the center is closed, at least consider leaving the king there and not castling at all. This is especially true if there is action on both wings.
- In a relatively quiet position, where no tactics are present, it's often a good idea to play developing moves if you haven't developed your pieces yet. You may not realize it, but castling is one such developing move! It "develops" your king to a safer position, while also moving a rook to a more central file, where it can more easily become an active part of the game.
- The majority of the time, if you aren't certain which side of the board to castle on, the correct answer is the kingside. It's quicker to castle here (since the queen must move in order for you to castle queenside), and in most openings, it's usually safer. Black is especially likely to favor kingside castling over queenside, as White will have the early initiative more often than not.
- Of course, if your kingside pawn structure has already been compromised, castling queenside may prove to be your best bet. In addition, castling queenside can often lead to powerful attacks. Games in which one side castles queenside while the other castles kingside can prove to be some of the most exciting battles of all, as both sides can storm the opponent's castled king with pawns. Usually, this creates a race situation where the first side to break through the other king's defenses wins, and sacrifices abound!
- If you've reached the endgame, and/or the queens are no longer on the board, don't assume you have to castle just because you can. Because checkmates are unlikely, it's very possible that your king is better served by moving towards the action, rather than running away from it.