If a colony of bees loses its queen, the workers will create a handful of new queens from the last eggs the former queen has lain. They feed a few of these royal jelly and expand out their wax cells to accommodate the overlarge females. Once a new queen has emerged (and dealt with the other claimants), she departs alone and takes her nuptial flight. There are places that drones from many colonies gather (since they do no work for their colonies) and the queen flies to one of these to mate with these foreign males. She may fly agains someday if the colony prospers and she departs with a swarm to found a new hive, (leaving a new queen behind to supercede her) but she won't mate again.
Sometimes though, a queen will fail without leaving behind any fertilized eggs, and so the workers can raise no new queen. In this case workers will often begin laying eggs. But because the worker bees are not fertilized these eggs cannot be nurtured into a new queen. In fact, its a quirk of bee genetics that unfertilized eggs become the male drones. So at first glance the behavior seems pointless in the doomed hive. Once the last generation of worker bees die there will be no more colony.
But there is a evolutionary sense to it I suspect. This failed colony will mother no new queen -- no new swarms to carry forth the genetic heritage. But there are two ways to reproduce, of course, you can mother a new colony or you can father one. What these worker bees are doing in their last gasp effort is cloning themselves into males who might be that father, who might win the lottery and find that queen out there on her nuptial flight and be the father to a hundred thousand busy descendants.