All beer leaves the brewer carbonated. This is accomplished in one of two ways - natural and forced carbonation. In both cases, beer and carbon dioxide are sealed in a container under pressure. The beer absorbs the CO2 giving the beer its fizz.
Natural carbonation results from the fermentation process. Fermentation produces alcohol and carbon dioxide as yeast digests the sugar in the wort. Although most of the carbon dioxide is allowed to escape during fermentation the brewer will seal the beer in a container when it is almost complete.
This is how natural carbonation is used to carbonate beer in holding vessels at the brewery and in casks.
Anther way to use natural carbonation is in the bottle. In this case, the beer is allowed to ferment completely. It is left unfiltered which leaves active yeast suspended in it. Then a small amount of sugar is added at bottling time. Once the bottles are sealed and the yeast begins to act on the sugar, CO2 is released and absorbed by the beer.
When beer is force carbonated it is allowed to fully ferment. Then CO2 to pumped into a sealed container with the beer and absorbed into the liquid.