We've all seen it happen, a healthy bowl of fruit on the table turns into a swarming mess of fruit flies and their eggs. These pests do serve a purpose though, in an area one wouldn't expect. Beer. Fruit flies are attracted via smell to food sources that are yeasty. Several acetates in beer, that give it flavor, will attract flies by the dozen. Wild yeast contains these and when a group of chemists got together to see what was happening, they noticed that yeast cells would stick to the flies and then get carried off, as a pollination or colonization process. Mutant cells, that did not contain these acetate compounds, did not attract fruit flies and therefore was not colonized.
It's a matter of evolution, the yeast cells have developed specifically to attract the flies, who then carry them off to make more yeast. Yeast that brewers use to develop more flavorful beers via fermentation. So, while they might be annoying, the fruit flies are assisting the yeast in colonizing and making more of what brewers need to make beer better. So buy that fly a cold one next time.