I poured some Pepsi into a mug, and it foamed, and I poured until the foam was at the top of the glass. I waited a few seconds for the bubbles to go, and the liquid level was revealed to be at around the halfway point. Then I poured Pepsi into the mug again, but this time there were almost no bubbles at the top -- I'd expect proportionally, if first time there was 50% foam, this time there should be 25% foam, which is significantly different from the ~5% bubbles observed. Why is this?
Carbonated beverages, contains carbon dioxide that has dissolved under pressure (usually at twice the atmospheric pressure). When the pressure is released by opening the soda container, the liquid cannot hold as much carbon dioxide, so the excess bubbles out of the solution.
When you first pour the soda, you relieve even more CO2 out the solution by the simple act of pouring it. This means you have less CO2 in the solution that you think you should.
A second reason you have less bubbles is the surface on which it is poured. The soda already in the glass acts as a buffer to the release of more CO2.
This is the reason why soda expels the gas faster when poured over ice than an empty glass.
the bubbles come from exsolvation of CO2 at seed sites on the insides of the (initially) dry glass. those seed sites are tiny pits and crevices with air trapped in them, which the pepsi will wet out and deactivate upon pouring the first sample. Only the smallest seed sites will remain active (unwetted) by the time of the second pour.