This is physics rather than Earth Sciences, but differential pressure between tinned liquid and atmosphere is by far the dominant factor. In Scotland I remember opening a can of 7-up at sea level with almost no effervescence. Then I climbed Ben Nevis, 1344 metres, and celebrated reaching the summit with another can. The resulting 'geysir' ejected about half the can in spectacular fashion. Temperature also has an effect in that the solubility of CO2 on a cold day, say 10 deg C, is about 30% more than on a hot day of ~30 deg C. So if the outside temperature is warmer than at the time the drink was canned, then there will be an excess of free gas that has come out of solution, but is still in the can waiting to be released. If we say two grams of excess CO2 in the can, that will yield about a litre of gas at one atmosphere and 21 deg C.
I'm wondering what the effect of a high sugar content would be. Could large organic molecules act as foci for gas bubble formation? Maybe a fun school experiment!