Flies do not necessarily lay eggs in a clean carpet. Still, they will lay eggs on spillages, food, urine, etc., left unattended on the carpet. They hatch into fly larvae in the carpet and eventually turn into maggots.