Judging from my own experiences with broody hens, I doubt hen knows when an egg is viable or not. I've had hens roll eggs out of their nests that hatched after I slipped them back under the hens. I've seen a determined broody hen (not my own, I would never do that) sit for 3 months on a rotten egg once and I recently swapped a broody hen's eggs for golf balls after she broke an egg in the nest and I had to clean it up. I finished the eggs off in the incubator and she happily sat on the balls, until I replaced them with her chicks. In my experience a broody would sit on anything that resembles an egg, whether it is an egg, alive or dead, or not.