Males stay in the nest at all times and don't sting at all. Worker bees are infertile females so they cant make babies and are the only ones who sting. Queens are the only ones who are fertile but they never leave the nest. The reason why only female workers sting is that the stinger is a modified organ for laying eggs, but since the workers can't lay eggs, they sting instead. And also, once they sting, they die because the venom sack is attached to their guts so they disembowel themselves.