if there is no rooster in a flock and a hen doesn't mate, then all the eggs she produces would be infertile.
Correct
So what is this I'm reading about "broody" hens? Is it that they "want" to be mothers and want their eggs to be fertile and are acting as if the eggs would hatch?
Correct
If there is a rooster in a flock, does that mean that the hens would mate constantly and all the eggs would be fertile?
Depends. Most full sized roosters can keep 10 to 12 hens fertile, bantams can usually keep 12 to 15 hens fertile. It also depends on age. Once he gets over 3, most roosters slow down a bit. The older they get, the more they slow down. After mating, it usually takes 2 days for the eggs to be fertile. The eggs will normally stay fertile for 2 weeks after mating. A rooster does not usually mate with every hen every day unless there are very few hens. You will notice that I am using a lot of weasel words like most, usually, and normally. It varies with individual chickens but these are the usual results. For example, sometimes a hen will stay fertile for three weeks after mating, but two is normal.
If not what causes some eggs to be fertile and others not?
There are several things that can cause unfertile eggs, such as bad nutrition or old age. Some breeds, such as Orpington and Cochin have so many feathers that some breeding attempts are unsuccessful. Serious breeders actually trim vent feathers on these breeds. Not all attempts are unsuccessful but fertility can be reduced. An older hen may not let a young rooster not confident enough in his roosterhood to mate with her. Sometimes he has to dominate her.
Hope this helps.