A colony of bees (or ants or termites for that matter) can and should be viewed as a singe organism. The individuals within that organism do not act in their own interest, they act in the interest of the colony organism. Evolutionarily seen the unit on which selection takes place is of importance. For bees that is not the single bee but the bee colony.
John Maynard Smith (an evolutionary biologist and geneticist) sums it up generally in the following way 1988: “Any population of entities with the properties of multiplication (one entity can give rise to many), variation (entities are not all alike, and some kinds are more likely to survive and multiply than others), and heredity (like begets like) will evolve: A major problem for current evolutionary theory is to identify the relevant entities.” For the bees this “entity” is clearly the colony.
In the same sense it is evident that the queen is not the boss/leader of the colony, she serves the colony just as much as the worker bees do. If she fails or wavers at her task the workers will dispose of her and promote a sibling to the position of queen. They do not come to this decision collectively, there are no bee comities that come to these decisions. A certain circumstance automatically results in a certain predictable outcome without intervention of any authoritative figure. There is no one telling the workers bees to forage or feed the larva or clean cells or do any of the myriad of tasks the workers perform but they still perform them. This behavior is “preprogramed” genetically.
You can compare the individuals in a bee colony with computer programs that reacts to certain inputs in predictable straightforward ways. Programs that simulate the behavior of eusocial insects (from wikipedia: “Eusociality, the highest level of organization of animal sociality, is defined by the following characteristics: cooperative brood care (including brood care of offspring from other individuals), overlapping generations within a colony of adults, and a division of labor into reproductive and non-reproductive groups”) often use ants as a model organism as ants don’t have to deal with a 3D world outside of the colony.
From the site of one such ant simulator the principle is describes aptly (corrected for grammar): “The simulation is based on the fundamental principle that each ant is not intelligent enough to understand it lives in a complex community, nor is it able to organize tasks in its colony. Therefore, each ant lives and works following some simple rules interacting (unaware of it) with the others through chemical signals. From these thousands of connections a self-organization of the whole colony arises, which leads an observer to believe that someone has imposed some kind of strategy.”