Many small creatures in nature have learnt that working together in groups enables them to accomplish much more than doing it as an individual, and swarming is just one of these ways in which these creatures work together as a team. Insects in a particular swarm, swarming is just another word for gathering together, but when associated with insects, it is defined as swarming. Locusts, wasps, yellow jackets, hornets and of course bees swarm. Bees swarm usually as a defensive measure, if their colony is under attack, they also gather together when in search of new resting grounds.
When under attack, bees swarm the intruder and launch an attack trying to chase it away. This is usually started by one bee stinging the intruder and releasing a pheromone, which acts as a signal for the other bees to follow. When looking for alternative nests, bees swarm into scouting parties and move out in search.
While swarming, all bees watch what is considered dances from each other and based on the enthusiasm of each individual bee performing the dance, the rest of the swarm makes a decision to follow a particular bee. This action normally occurs when seeking a new nest, as the swarm must decide which scout to follow. In terms of the swarm for attacking the pheromone is usually the deciding factor of when and where to attack.
Beekeepers, when they see bees swarming, would try to attract the bees by using pheromones and direct the bees to a new habitat they have built. If individuals ever witness bees swarming it usually means they are relocating, in this case, one should make sure it is not near their home. If in doubt contact the local environmental health office or a reputable beekeeper and seek advice on the next steps to take.