Chickens — like other birds — lay fertilized eggs via sexual reproduction. Depending on the breed of chicken, a hen will begin laying eggs between five and seven months of age. The frequency of egg-laying varies between breeds, over different seasons, with moulting and with age, but most breeds that are used for egg production will lay an egg every one to two days.
TL;DR (Too Long; Didn't Read)
Chickens reproduce via sexual reproduction: a rooster mates with a hen, who then lays a fertilized egg.
When Are Eggs Fertile?
An egg will only yield a chick if the hen has mated with a rooster before the egg was formed. Most production-oriented farms don't have a rooster milling about, unless it's time to make a new batch of egg-laying hens. This means that almost all eggs in the supermarket are unfertilized.
Roosters are more often seen in small or hobby flocks. With farm-fresh eggs obtained from a smaller flock, it is likely that almost every egg is potentially fertile. But don't worry: the embryo is usually a mere speck on the yolk, and stops growing when the egg is refrigerated. Fertilized eggs require twenty-one days of incubation at a specific temperature (the temperature it would be under a mother chicken) in order to produce chicks.
In outdoor conditions, chickens will breed when the days begin to get long in spring. While the rooster will mate with his hens throughout the year, she typically only incubates eggs when conditions are optimal. A hen choosing to incubate eggs is said to have "gone broody."
The Rooster Does His Part
Roosters have reproductive organs not unlike mammals, with testes that produce sperm. The sperm travel down tubes called vas deferens to sperm sacs. During mating — an unceremonious affair that lasts less than 20 seconds — the sperm leave the male through an opening called a cloaca, and enter the female through an entrance to her reproductive tract, called the oviduct. From there, the sperm make their journey through the reproductive organs of the female. In a trip that may take a week or more, they swim through the hen's shell gland, then a narrowing in her reproductive tract called the isthmus, followed by the magnum and the infundibulum. There, they await the arrival of eggs in the process of forming.
The Hen Also Does Hers
A hen's eggs begin as yolks in the ovary, and once released they pass into the infundibulum, a funnel-shaped organ where the sperm are waiting. There they are fertilized, and pass out of the chicken via the same route the sperm entered. The egg white gathers around the yolk in the magnum. In the isthmus, the shell membranes are laid down. The shell forms and hardens in the shell gland, and the egg is ready to be laid. Most hens won't lay eggs in the evening, so if a hen's egg is ready then, she will likely hold it until morning. Once she does lay, she's ready to start forming a new egg. After mating, enough sperm may remain in the hen to fertilize her eggs for a week or more.