Look at the bottom of your radiator cap. There are two seals. One that seals at the top neck and one that seals at the bottom of the filler neck. As the fluid heats up it expands. It eventually over powers the primary spring in the radiator cap.
The bottom seal is broken as the pressure exceeds the spring force of the cap and the cap rises. Fluid then enters the overflow tank until enough pressure is relieved to allow the spring to force the bottom seal back into place.
You'll also find on the bottom center of the cap that there's a brass or stainless circle plate. That circle plate actually creates a one way check valve. When the engine cools back down the coolant shrinks in volume. As that happens the pressure in the coolant system becomes a vacuum pulling down on the bottom circle plate and thus opens the check valve.
Once the valve opens the fluid is drawn in through the tube that leads to the bottom of the reservoir and refills the system. The system is actually self burping in that it evacuates air on each temperature cycle. Air is pumped out when the system gets hot and fluid is then drawn in when it cools.