Mold can grow on the underside of the roof due to problems with a ventilation system inside the home. For example, moisture may rise into the attic as a result of exhaust from the bathroom or laundry room. When this moist, warm air penetrates the attic through the ventilation system, the underside of the roof can become subject to mold due to the combination of moisture and warmth.
Roof surfaces are subject to a variety of organisms, including not just mold, but also algae and moss. Roofs attract all of these unwanted organisms because of a combination of rain water, humidity and lack of sunlight. Under these conditions, organisms like mold have the perfect environment in which to grow. But once again, if the mold seeps from the surface of the roof to the underside, you must also locate a problem with ventilation.
In some cases, you may grow mold on the underside of the roof despite having your shingles in perfect working order. This usually indicates a problem with humidity. Humidity is a measurement of moisture in the area, and indoor high humidity can contribute to mold on walls, ceilings, tiles, upholstery and even roofing materials. For instance, if you have high humidity in your attic that causes moisture to penetrate the roofing material above, you may find yourself with mold.
Though most shingles are only mildly porous, there are exceptions to the rule, particularly wood shingles like cedar. With enough water exposure, the entire wood surface can become saturated, potentially leading to mold growth on the top as well as the underside of the roof surface. Due to the high level of porosity, these shingles may require replacement if mold takes hold of them. It's best to paint wood surfaces with a mold-resistant paint or finish before mold has a chance to become a problem.