I think it depends on what you're trying to achieve (although in all cases once fermentation is over, or nearly over, try to avoid too much splashing/oxygenating of the beer).
If you were kegging for keeps then the normal way would be to prime the barrel (add more fermentable sugar) at about the time you fill it - which causes a small extra fermentation, generating CO2 which gets trapped in the headspace pushing the lighter air above it away from the beer. You can help by venting a bit to remove the top layer of air, but don't over-do it as its because most of the pressure can't escape that the beer becomes carbonated. If you have a Co2 injection system on the keg (such as from an S30 cylinder) you could inject pre-made Co2 and vent off the lighter oxygen - to fill the head space manually/instantly rather than waiting for the priming to do so.
If you were just using the keg as an un-pressurised secondary fermenting vessel then ideally you'd rack to it before the end of the primary fermentation so the tail-end of that caused the air above the beer to be replaced with CO2. After this you would bottle, priming the bottles (or the beer to be bottled) at that stage - to do to the bottle the same thing that priming the keg does to the keg.
It is possible to do a hybrid - keg and prime as above and later decant to bottles to avoid priming in the bottle. But its tricky to retain carbonation during the transfer and if you don't purge the bottle of air with Co2 beforehand you'll not have a secondary fermentation in the bottle to help out either. I tend to take this approach (from cornies) to take bottles to parties etc but it never seems to give a true bottle-conditioned result and I'd doubt how long they'd keep.
Cheers
kev
EDIT: sorry that was a bit long winded - as mentioned below its not actually very complicated, you just want some CO2 over the beer and it can either be put there by priming or by squirting some in from a cylinder.