It happens more with caged animals that are wallowing in their own poo, or the poo is what they eat, sleep and bathe in. In factories, they have mountains of poo under the wire cages that hold the chickens. Humans have to suit up and wear masks when they go in, to not breathe it......and they will occationally clean it out if there is a samonilla scare or spray the mountain of poo with chemicals......SOme factories are getting better on sanitation, but noit many as, more work=paying for more man hours, and as you can tell, eggs run cheap.
If you have healthy birds and a healthy coop, giving then Apple cider vinegar in their water (look online for measurements) and they have pro-biotics to add in or already in food, your hens will be happy and healthy. I guess there is really no WAY of telling, unless you have a chemistry lab in your house and you test the poo, chickens vents and eggs themsleves... So good luck! LOL!!! I feel VERY comfortable eating my backyard chickens eggs....Don't stress so much and enjoy your eggs, they are SOOOOO good!!!!