Shaking causes small bubbles, which helps the soda's carbon dioxide escape faster. The gas will gradually escape from the liquid as bubbles once the can is opened, and the soda will become "flat." The dissolved gas takes a long time to escape if the liquid is treated gently.