Remove the cap from your empty soda bottle and insert the ketchup packet. Fill the soda bottle all the way to the top with tap water and screw the cap back on the soda bottle tight. The ketchup packet will be floating at the top of the bottle. Squeeze the bottle and the packet should sink to the bottom of the bottle. When you stop squeezing, the packet will float back up to the top.
The reason the ketchup packet floats at the top of the bottle is because there is a small bubble of air inside the packet making it less dense than the surrounding water.
If you were to, say, drop a pebble into the bottle of water, it is denser than the water and it will sink to the bottom. There are two forces acting on the pebble: gravity and buoyancy. Gravity attracts the pebble to the bottom of the bottle, or exerts a downward force on the on the pebble. As the pebble sinks to the bottom of the glass, the water in the glass is pushed out of the way, or displaced by the pebble. The other force acting on the rock is buoyancy and it exerts an upward force on the pebble. The gravitational force is greater than the buoyancy force--the pebble weighs more than the water it is pushing out of the way or displacing--and the pebble sinks. Conversely, the ketchup packet floats because the buoyancy force is greater than the gravitational force—the packet weighs less that the water it displaces.
When you squeeze the bottle you’re pushing the water against the ketchup packet making the bubble of air inside the packet smaller (water does not compress very well, so the air inside the packet gets compressed instead). As the air bubble in the packet gets smaller, or the volume of air decreases, the density of the packet increases. As the ketchup packet gets denser, it sinks. When you stop squeezing the bottle, the compressed air bubble inside the packet can expand. This increases the volume of air in the packet making it less dense than the water in the bottle and the ketchup packet floats back up to the top of the bottle.
Here’s a fun fact: evidently the “Cartesian” diver was not actually invented by the 17th century philosopher, René Descartes. Instead it was apparently invented by a student of Galileo, Raffaelo Maggiotti.