Once my professor said that seawater/river water looks foamy because of the presence of organic molecules which breaks up the hydrogen-oxygen bonds and air bubble takes its place, then the bond tightens to make it clear. Is the mechanism relevant to this, or is there something else?
I don't know the first thing anent chemistry and little of fluid dynamics, but I'd theorise it's more likely that shaking up water in a bottle merely moves the air which had been on the top half to the bottom, which is then quickly trapped by the water, forms bubbles that rise back to the surface where some retain their shape briefly due to the marangoni effect / water's surface tension. 'fcourse, if you've access to any professors asking them might be preferable.
Specially trained smart people spend a lot of time working on that question. It is important in root beer, alcoholic beer, wine, sparkling water, and several other fields. There is even an industry devoted to selling bubble making equipment and solutions. Those people call themselves "fizzicists". (At least some of them do.)
Maybe you can locate some of what they have learned. Start here:
The development of foam occurs due to changes in the water surface tension and the physical introduction of air. There is a slight tension on the surface of water caused by the chemical attraction among water molecules.
Scientists point to several factors. Specifically, the earth has an abundance of liquid water; it is located at the right distance from the sun; and it contains the right mixture of atmospheric gases, including large amounts of oxygen.
You may be surprised to learn that the Bible book of Genesis refers to these very features in the creation account. For example, Genesis 1:10 describes God’s bringing together “the waters [that] he called Seas”—a clear reference to an abundance of liquid water. At Genesis 1:3, we read: “God proceeded to say: ‘Let light come to be.’” Our planet is located close enough to the sun that most of its water stays liquid, yet not so close to the sun that all the water would evaporate into space.
For more information on this subject and others, please go to jw.org "Online Library." Also for free downloads, publications or read online.