When a bee flies through the air, it experiences friction. The air pushes, against the bee's hair, there is friction between the air and the hair, and thus the hair gains a positive electrical charge.
Scientists have found out that most flowers and pollen are negatively charged. When the bee lands on the flower, the pollen sticks to its hair because it is positively charged.
When another bee comes near the flower, it can feel that some of the flower's electrical charge is gone due to another one of its kind being there, so it knows not to waste its time stopping there.