Chemist Chuck Wight of the University of Utah provides the following explanation:

Small bubbles caused by shaking help to hasten the escape of the soda's carbon dioxide. Cans of carbonated soft drinks contain carbon dioxide under pressure so that the gas dissolves in the liquid drink. Once the the can is opened, all of the gas will eventually escape from the liquid as bubbles, and the soda will go "flat." If the liquid is handled gently, it takes a long time for the dissolved gas to escape. If the can is shaken, however, or if the liquid is poured quickly into a glass, then the bubbles formed by turbulence provide an easier way for the dissolved gas to escape.

It's difficult for the gas to escape from an undisturbed liquid because of the liquid's surface tension, which is the energy required to separate the liquid molecules from one another as a bubble forms. For a tiny bubble just getting started, the amount of energy required per molecule of gas in the bubble is relatively large. So getting started is the difficult stage. Once it is formed, however, a smaller amount of energy (again on a per molecule basis) is needed for additional liquid molecules to vaporize and expand the bubble. The basic reason for this dependence on bubble size is that whereas the volume of the bubble is proportional to the number of molecules inside (at constant pressure), the surface area of the bubble is proportional to the number of molecules to the 2/3 power.

Because shaking the can introduces lots of small bubbles into the liquid, the dissolved gas can more easily vaporize by joining existing bubbles rather than forming new ones. By avoiding the difficult step of bubble formation, the gas can escape more quickly from shaken soda, thus resulting in more fizz.

Answer originally posted April 23, 2001.