If you leave rotten meat uncovered in the open, you'll soon notice flies swarming on and around it. These insects are attracted to rotting meat, and not just because it's ideal for their eating habits -- it's actually instrumental to their breeding process. This means that if you leave the meat out long enough, you won't just see flies, you'll see maggots.
Flies live around that which is rotten and decaying, and that doesn't mean just meat. In addition to rotting meat like dead animals and food scraps, flies also live in and around mixed garbage and animal feces. This is partially because they live to lay their eggs in it -- some flies, like blowflies, actually deposit live larvae into rotting meat after they hatch inside the female.
Growing in Meat
The reason that flies lay their eggs in rotten meat is because it provides a food source as the larvae grow. Whether the eggs hatch inside the mother or in the meat, like a housefly's eggs do, they start out as maggots -- and maggots are hungry. These wingless adolescents need to feed in order to grow and develop into adult flies, a process that can take as little as eight days. When the eggs are laid in rotten meat, the maggots have all the food they need as they develop.
Typically, flies don't travel more than 1 or 2 miles when they're looking for food, but they are capable of flying as far as 20 miles in search of a meal. That in mind, flies are attracted to rotten meat for the same reason they're attracted to wet garbage and feces: It's odorous and easy to find. The pungent, unmistakable smell of rotten meat is easy for flies to sniff out, giving these opportunistic feeders an easy way to find their next meals.
Because they have no teeth or jaws, flies do not eat solid food the way humans can. Instead, they use their spit to partially dissolve solids, turning them into liquids that they suck up through their strawlike mouthparts. Rotten meat like scraps and animal carcasses is a valuable part of their diets, then, because it has already started to decompose and is relatively easy to liquify and consume.