If you're playing someone GOOD, the general rule is to absolutely castle early. White's tempo advantage is not enough to generate that quick of an offense that Black can't set up his defense. And because White is ahead in tempo, unless White wastes moves, Black needs to defend first before he attempts to counterattack (which means castling).
The reason why people castling Kingside like 90% of the time is because there is often time-pressure to castle early. It's hard to find the extra tempo to move the Queen and still be able to castle early enough without coming under attack. I've rarely seen anyone playing Black castle long.
In top level chess, I think people castle in the first 5-12 moves like 99% of the time. The King is just WAY too vulnerable in the center to risk castling in the middle game.
There's almost no need to castle in the endgame because you want to activate your King in the center of the board, rather than hide it in the corner. And if the King is in the middle, it's easy to activate the Rooks. So castling in the endgame would serve little purpose.
Hope this helps Jailer :)
I've seen many people that believe to castle in the beginning, middle, and end. Which one is best?