How often does it happen? Not very. It has nothing to do with the egg being "alive" with a chick.
If bacteria gets inside the egg it can multiply. Incubation temperature is perfect for that. But as the hen is laying the egg she she puts a coating on it called bloom that helps stop bacteria from getting inside. As long as that barrier stays intact a hen can lay eggs for two weeks or more in a nest, then incubate them for three weeks without problems. If the barrier breaks down and bacteria get inside you can have problems. It does not matter if the egg is fertile or not. If bacteria does not get inside, you do not have a problem.
How can you prevent this? Don't set dirty eggs. If an egg is dirty the barrier may be compromised. I'm not talking about a light dusting, I'm talking about a clump of poop or dirt. If you are using an incubator sterilize it to eliminate the bacteria. Keep your hands clean when handling the eggs, gathering them or any other time like setting, turning, or candling. Avoid oily hands.
Do not remove that bloom. Don't wash them or sandpaper them to clean them. Leave the bloom intact. If the egg is dirty enough to need cleaning don't incubate it to start with.
As long as your hands and equipment are clean candling will not cause bacteria to get inside. It will not prevent it either. If you sniff them when you candle (or turn them or do anything else with them) you might be able to tell when one is going bad but it will not stop one form going bad. Candling does not help an egg to hatch, it does not harm a hatching egg as long as you don't drop one and crack it or get it dirty. Candling is for your curiosity, nothing more.