You WAIT until the batch has finished fermenting BEFORE you bottle/keg it up. Otherwise, if you bottle, you'll run a very real risk of 'bottle bombs'... These are bottles that either pop their tops, or literally shatter like bombs would. NOT a good thing no matter who you are. Use one of the priming calculation sites to figure out how much priming sugar to use (by weight) and prime it in the bottling bucket as you should.
IF you're kegging the batch, then wait until it's finished and ready for drinking (other than not carbonated). Then transfer to serving keg and carbonate at serving temperature, at the pressure to reach the carbonation level you desire (there's a chart available)...
Don't be fooled, you need some kind of sugar for the yeast to eat IF you're bottle carbonating, or not using a forced carbonation method. You can use a variety of different sugars from corn sugar to cane sugar to honey or DME... How much you use depends on not only the type of sugar, but the desired CO2 volumes level and temperature of the finished beer.