When bees swarm, the first swarm happens when a queen cell is sealed. The current queen and a sizable portion of bees leave the hive to set up a new hive elsewhere. Sometimes, you also get casts when the queens hatch out and one by one they leave the nest, with smaller and smaller groups of worker bees. The first swarm may be the size of a football, and the last the size of cricket ball.
Once the old queen has left, it takes about three weeks, for the new queen to emerge, mate and start laying her eggs and then it takes about another three weeks for the new workers to start emerging.All the while the colony is not increaing, and so may not be able to take advantage of any honey flow.
Swarming used to be a desirable trait before they invented moveable frames as the beekeeper would have to kill the bees to collect the honey. This is when bees were kept in skeps (ie the traditional straw beehives). With moveable frames, the beekeeper no longer need to kill the colony to get the honey, so much of your time as a beekeeper is spent trying to avoid swarms as the more swarms, the less honey.
You can tell a colony is about to swarm when there is a build up of drone brood comb. Drone brood comb is usually the first sign, and then the heart sinks as one discovers fully developed unsealed queen cells. You can cut out the queen cells and buy yourself -- two weeks of time. Other method include the complex and complicated Snelgrove method. Keep doing this and they may give up all idea of swarming, but then once the idea gets in their tiny brains....
The main reason for swarming imho is that the colony gets too big for one queen to control. She controls the workers through her pheremones, but other beekeeepers may disagree.
Bees swarm because it is the way they increase their colony or so they think. Today, you have the varroa mite, and any colony in the wild has very little chance of long term survival. Unfortunately. As a beekeeper, you have to take precautions -- a specially adapted floor, treating with Apistan or Apiguard at the correct time, and there are few other newer methods.
A bee swarm is generally not dangerous when it first leaves the colony. This is becuase the bees gorge on honey. But after a few days, they become hungry and ill tempered. If you spot a bee swarm, the best thing is to call the council and they will give you the name of an expert who can come and remove it. Or capture it for you. If a swarm is in your garden, it belongs to you, unless the beekeeper saw it emerge from his/her hive. A nucleus of bees can cost about a hundred pounds to acquire commercially.
Thus endeth the lesson.