The key to making this work is to choose a condiment-packet diver that barely floats. This works because, while many sauces are denser than water, it’s actually the air bubble sealed inside the packet that determines whether it will sink or swim.
Squeezing the bottle increases pressure on the condiment packet, compressing the air bubble inside. When the higher pressure compresses the air in the packet, the packet displaces less water, thus decreasing its buoyancy and causing it to sink. When you release the sides of the bottle, the pressure decreases and the air inside the packet expands once again. The packet’s buoyancy increases and the diver rises.
The Greek philosopher Archimedes was the first person to notice that the upward force that water exerts on an object, whether floating or submerged, is equal to the weight of the volume of water that the object displaces. That is, the buoyant force is equal to the weight of the displaced water.