Like all infestations they literally fall from the sky. Passing wild birds are the culprits, drop them onto the ground and they jump onto the first available host. They are a very tiny mite which lives and burrows under the scales. Their poo builds up and gradually forces the scales upwards effectively tearing them off. Fungus can grow in the poo as well which makes it far worse. Very painful for the chickens.
Worst case I saw was on a cockerel at a customer's house (worse than any internet photos). His hens had been killed by a fox and Boris was on his own and very neglected. The fungal growth was 10mm thick and went over his knee joint. Scales were not visible. He couldn't move his toes at all, it was as though his legs were encased in concrete! I rescued him and he was treated -took about 6 months before it all fell off and new scales started to grow.
It spreads between chickens in a coop very slowly, but you are wise to treat all if you have one. Doubt the cleanliness of the coop has much to do with the mite but will be the cause of subsequent fungal infection.