There many possible causes, but here in Chicago they usually come down to a source of warmer moist air from conditioned spaces below entering the attic and condensing onto colder surfaces, usually on the sheathing and rafters or trusses.
Assuming that the mold growth is not localized and clearly related to some specific moisture source (a kitchen or bathroom mechanical exhaust fan venting and the attic, a poorly sealed attic access hatch or pulldown stairway, an open chase communicating with conditioned space below, poorly sealed HVAC ducting - something of that sort), for example:
then the problem is usually related to some combination of 1) multiple contributing sources of moisture in the attic (everything from continuous stud bays to the basement to poorly sealed recessed lighting fixtures in the ceiling below the attic), 2) insufficient insulation and vapor retarders between the condition space may attic, and 3) insufficient attic ventilation.
In a climate like Chicago's, the "typical" example (I observe this in around a quarter of the homes I inspect) takes the form of an attic with moisture damage and mold at the sheathing, most prominent the north side of the roof and closer the ridge, and the most common cause (assuming that this is a relatively recent condition) is that additional insulation has been added without taking care to preserve sufficient airflow from the soffits to the high vents at or near the ridge (the peak of the roof).
Other common causes include changes in venting intake and exhaust (for example recent re-roofing, and the ridge venting was nailed down too tightly, obstructing flow) and/or changes in occupancy and use. For example a client with three or four teenage children moves into a house previously occupied by a single, older owner - suddenly a lot more moisture from cooking, bathing and just human respiration is being introduced into the conditioned portion of the structure - or because the owners have recently installed a central humidification system and the supply ducts pass through the attic.
Deciding which of the three factors: moisture infiltration from conditioned spaces, insulation and vapor retarder's and attic ventilation (or which combination, and what proportion) is going to be the most effective (or the most cost-effective) to modify is a decision that has to be made on an individual basis for each property and occupancy.
And even then, there is a substantial element of trial and error - often you try the simple and least expensive solution first, even if you are not really confident that it will (completely) solve the problem.
For example if there are recessed lights in the ceiling below (a common pathway for conditioned air to to enter the attic, especially if they're located in a kitchen or bathroom) I look for evidence of increased discoloration at the sheathing above the lights, the same is true of other sorts of penetrations as well.
If I see this kind of localized discoloration in addition to the generalized discoloration on the north side it's possible that reducing air infiltration at these locations may
be sufficient to substantially reduce condensation on the attic sheathing even if other problems (for example poor attic ventilation) are still present.
So it's possible
that reducing air infiltration at this point will be sufficient to lower attic moisture levels to the point where condensation is no longer a major problem.
A roofer looking at the same attic may know from experience that improving the attic ventilation will also substantially reduce condensation, and if he or she recommended this solution they would not be "wrong", it just might not be the most cost-effective
way to solve the problem (or, it might) - and unfortunately there is often no way to determine which solutions will "work" except by attempting them.
Home Inspection: "A business with illogically high liability, slim profit margins and limited economies of scale. An incredibly diverse, multi-disciplined consulting service, delivered under difficult in-field circumstances, before a hostile audience in an impossibly short time frame, requiring the production of an extraordinarily detailed technical report, almost instantly, without benefit of research facilities or resources." - Alan Carson