The gas sits mostly at the top of the bottle pressing down on the water. In the water is a tube, one end of which is near the bottom and the other at the valve which opens to the nozzle. As you open the valve, water is forced into the tube by the pressure (the gas cannot pass through the water). The water level falls until all is gone at which point you get what remains of the gas hissing out. Same principle as spray cans, except the cannot generally be refilled. If you turn either upside down the gas rises to the bottom of the container - release (open the valve) and you get what liquid is already in the tube followed by pure gas. This way you clean out the nozzle on a paint spray can, fresh to start the next time around - but you lose some propellant (gas).