When the bees swarm, the queen and about two thirds of the worker bees leave the hive and find a spot where they hang in a cluster. The queen settles somewhere, usually within a 100 meter radius and the worker bees congregate around her. Scout bees will then fly around and try to find a suitable place for the new hive. Once a new place is agreed on, the whole swarm moves again, this time to the new hive location. This can be up to 3km from the original hive.
The beekeeper should try to find the swarm as soon as possible, so that they are not far away yet and haven't started to build new combs. Once the swarm cluster has been found - often in a tree - the beekeeper has to try to collect the bees in some kind of a box. Some beekeepers have special swarm boxes - as can be seen in the pictures below. The cluster of bees can be gently brushed or shaken into the box. If the queen is in the box, then the worker bees will follow her. The box can be left in the area for a short while, so that the rest of the bees get on board. The special swarm boxes often have some sort of queen excluder so that once the queen has been brushed into the box it cannot get out again, but the remaining worker bees can enter.
If nothing else is at hand, a cardboard box will also work fine to collect the bees and transport them back to the bee yard. Once the swarm is caught, the old and now queenless hive and the swarm need to be taken care of. See here for further info on that.