Flies are very sensitive to molecules that are emitted from meat and manure. They detect (smell) this with special hairs on their palps and antennae.
As meat 'matures', the putrid aroma increases the attractiveness to flies. Contrary to popular belief, flies also lay on fresh meat [or even on live meat (the crotch of sheep etc.) and open sores] but decaying material is easier to digest for the larvae, so the higher the pong, the more attractive it is to flies, because it will give their offspring a better chance to carry the genes on.
In warm conditions a fertilised fly lays her 100+ eggs on the meat so the hatched larva have a ready supply of food. The eggs hatch within 24 hours and become eating machines. They eat in the same manner as the adults; disgorge digestive juice and then suck up the softened meat. As quickly as 4 days the larva become fully grown and crawl away from the meat to turn in a pupa. 2 days later they hatch and start the whole rpocess over again.
As unattractive as flies and their larva may be to us, they provide a valuable service to all animal life by cleaning the environment from decaying cadavers before disease set in.