When a mommy fly and a daddy fly are very much in love, they hug in a special way and…
Just kidding.
Basically, what @YoBob said, with the mention that wet or rotting material is not always necessary. I had in my apartment what I assume was a very desperate fly that I suppose could not find any ‘normal’ place to lay its eggs. The eggs went behind my trash can, I guess. It was totally clean back there, not any bit of food or anything on the floor.
I had no idea, of course. Not until I woke up one morning to something out of Amityville Horror—all my windows were covered with flies. I’m pretty retarded in the morning pre-coffee and I’m sure my face was priceless, as I slowly tried to work out what the hell had happened and how to deal with it.
I later discovered the egg casings behind the trash can, just sitting on the floor. Kinda blew my mind. After that, though, I no longer let flies stay very long in the house.