To the amateur eye, a swimming pool is a beautiful, fun oasis to relax and play. We don't see most of the expensive machinery in a pool system, because it's usually tucked away in a nearby pump room.
The heart of the pool system is the water pump. In a typical pump system, an electric motor spins an impeller inside the pump housing. The impeller drives the water from the various drains through the filter and back out to the water inlets. Just before it flows into the pump, the water passes through a metal strainer basket that catches leaves and other large debris that might clog the pump.
Check out this video which includes a detailed explanation of how swimming pool pumps work: