A word of caution in the beginning:
This guide is dealing with worldwide distributed species associated with humans.
Please be aware that in your specific area additional species might be found in urban locations as well.
Also, this guide does not cover the quite distinct fruit fly genera Scaptomyza and Zaprionus, both of which can also be commonly found near human settlements.
Fruit flies are attracted by fermenting organic matter (fruits, mushrooms, wine, beer etc.).
Here is a composition of 7 different species caught in a vinegar trap during one day in a storage room in a European city:
However, the different species have their own preferences, so not all food sources are visited by all species in the same numbers.
Also, some species show seasonal occurrence peaks, while others are regular visitors throughout the year.
Peculiarly, some species are more readily entering closed buildings (e.g. D. melanogaster, D. repleta and D. immigrans are commonly found indoors), while other, although closely related to D. melanogaster (D. simulans, D. suzukii) might actually be more common in total numbers but are more reluctant to fly through an open window. This of course does not take into account that fruits containing eggs or larvae are taken indoors where these respective species then develop and hatch.
Some general advice when photographing fruit flies:
At least a side view and a view from top should be provided.
Patterns of abdomen and wings should be visible.
The SOPHOPHORA group:
3 common species: the 'superhero of genetic labs', D. melanogaster, its close (and often overlooked) relative D. simulans plus the well-known pest species D. suzukii ('SWD': Spotted-wing Drosophila).
In addition, there are several other, more or less completely dark species (the obscura-subgroup) in most parts of the world, which can be quite common, but none of these species has a global distribution.
Females are often difficult or even impossible to ID.
Common feature in males of this group: The presence of SEX COMBS on the fore legs (tarsi). If you find a Drosophila with sex combs, it belongs into the subgenus Sophophora.
The size of the sex combs can vary considerably among different species and can serve as an ID feature.
Here are two examples (left: D. suzukii; right: D. subobscura)
A further common feature of this group is that the dark bands on the abdomen are not interrupted in the middle, but this character is not unique to this subgenus.
D. melanogaster
Males: wings without marks, no visible abdominal appendage (epandrium)
D. simulans
Less often indoors than its sister species.
Females almost identical to D. melanogaster, eyes slightly larger in both sexes
Males with large epandrium
D. suzukii
Males with wing spots (not extending to the tip). Careful: there are several fly species from different families which also have wing spots).
Can tolerate freezing temperatures, and winter flies might be coloured darker (the one in the middle in the example below)
Females are special amongst Drosophila species, as they lay eggs in fresh (not rotting) fruit and thus pose a threat to cultivated berries and wineyards. They need to have a much stronger ovipositor ('chainsaw'-like) to cut open the skin of the fruit. Because of the larger sized ovipositor, the abdominal end is less rounded and more angled than in other species. The general posture is somewhat 'hunchbacked', which is apparent already in the field with some experience
=========================================================================
REPLETA-group
Two common species, a third one (D. mercatorum) also widespread (esp. in warmer areas), but I have never found it or seen reports of it.
[2023 UPDATE: in fact, I confirmed my first D. mercatorum and it seems to be not that rare, but might often be confused with D. repleta].
A common trait of this group is the spotted thorax. The abdominal stripes are interrupted in the middle. Generally larger than the Common Fruit Fly, males and females very much alike.
D. repleta
Lateral dark areas of the abdomen contain light spots.
Important feature is at the wing border: there is a dark spot at the costal break (but beware of *D. mercatorum, see below)
D. mercatorum
Very similar to D. repleta but generally paler, with the dark tergite bands narrower. However, can also have a dark costal spot, so that is no exclusion criterion.
D. hydei
Usually darker than D. repleta, without the dark spots at the costal break and the light spots on the lateral abdomen
Here is a side-by-side comparison:
=========================================================================
OTHER SPECIES
D. immigrans
Very common. Apperent even with the naked eye is its large size (often double the size of the Common Fruit Fly) and long wings. Wing pattern very typical with the two cross veins and three vein tips darkened. Sexes alike, abdominal pattern interrupted in the middle.
D. buskii
Pattern unmistakable ('trident' on the thorax). A small, elegant and slender species
D. funebris
The type species of the genus Drosophila, received its name in 1787. Some variability in color, but the complete abdomen is dark (not just the tip as in the Common Fruit Fly). Males can be identified by the strong setae (bristles) at the terminalia. Females might be confused with other darker species.
(the fly in the middle together with D. hydei, D. immigrans and probably D. melanogaster)
@carnifex