The solubility of carbon dioxide in soda is related to both the temperature and pressure. A cold, pressurized drink can hold more CO2 per ml of liquid. When you open a soda, the gas immediately starts to come out of solution. Bubbles form and rise to the surface - this is the familiar sight of a fizzy drink.
If you drink half of a large bottle of soda, and put the lid tightly back on, it will still go partially 'flat', since there is a large volume of compressible air above the liquid. Some CO2 comes out of solution until the pressure in the bottle rises, and an equilibrium is found.
To keep the remainder your drink fizzy if you only want to drink half of the large bottle, simply decant the part you wish to save for later into a smaller bottle, leaving less air inside.