Mold needs moisture, and attics get it two ways. The first is from below: warm, humid household air leaking into the attic through unsealed light fixtures, attic hatches, and — most often — bathroom exhaust fans dumped into the attic instead of ducted outside. That moist air condenses on the cold winter deck.
The second is failed ventilation: soffit intake vents blocked by insulation, or no balanced ridge exhaust. A properly ventilated attic flushes moisture out before it can condense. Roof leaks are the third source, and the staining pattern usually gives them away — a leak wets a localized trail, while condensation wets broad areas, worst on the cold slopes.