It can be either done in the secondary or in the keg!
It's a process of clearing the beer up by using coldness:-) a fridge or outside non-freezing winter temps. It allows the beer to become uncloudy or less cloudy.
Done before keg'n or bottling. I typically allow mine to set in keg for 2-3 weeks before I drink.
Spotted Dog Brewing
"This is grain, which any fool can eat, but for which the Lord intended a more divine means of consumption.. Beer!"
-Robin Hood, Prince of Thieves, Friar Tuck
"The nations of the West also have their own intoxicant, made from grain soaked in water...Alas, what wonderful ingenuity vice possesses! A method has actually been discovered for making even water intoxicated."
- Pliny the Elder