How birds color their eggs
Pigment glands in the wall of oviduct deposit successive layers of color as the egg passes through. Spotted or streaked eggs develop when pigment is deposited as they rotate through the oviduct. Rapid rotation and descent results in more streaking and slower movement leads to more spotting. The large end of the egg travels through the oviduct first and often picks up more color. (1)
Blue eggs develop after the deposit of biliverdin in developing eggshell during the last 5 hours before the egg is laid. Biliverdin is a breakdown of hemoglobin and diverting these chemicals for the use in coloring eggs may be costly for females.
Biliverdin is a potent antioxidant and recent research shows that its absorbance in the eggshell also reveals the health status of the female bird. Healthy females lay more colorful eggs. Young or unhealthy bluebirds may have pale blue, white, or even pink eggs. (2)
Sources:
1. Cornell Lab of Ornithology Handbook of Bird Biology
http://www.birds.cornell.edu/homestudy/
2. Egg coloration is correlated with female condition in eastern bluebirds (Sialia sialis)