Here, "the role of" indicates a type of or metaphorical position, not a specific job or rank. If we had "the mayor," my natural question would be: "mayor of what?" Since we are not referring to a particular office or title, "the" may be dropped.
For example,
She was treasurer of the committee.
indicates that she served in a capacity that may be commonly called "treasurer." This role may or may not be formally recognized, however. The sentence doesn't indicate whether her service as treasurer is an office, or if she has a title. On the other hand,
She was the treasurer of the committee.
suggests that the committee did designate an individual to serve as its financial administrator. Of course, if "Treasurer" is a formal title, then I would not say the presence or absence of the article changes the meaning in the same way, but that's a different matter.
For another example, consider the idiom
Who made him judge, jury, and executioner?
This does not imply that someone was literally appointed Judge of the District Court, then tapped to serve as the sole juror for docket #1152, then hired to execute the convict. These are metaphorical roles, and the question is a rhetorical one, to wit: why is he allowed make and execute all decisions without considering others' input, as if this were a kangaroo court where he controls every part of the process?
Who made him the judge, the jury, and the executioner?
in contrast does ask the literal question. It implies that in this case, there is to a judge, a jury, and an executioner, and somehow he was made all three.
To come back to the original example,
SimCity, for example, casts youth in the role of mayor.
is suitable because we are talking about some kind of municipal chief executive, not a specific office. After all, a SimCity mayor's powers vastly exceed any real-life mayor :).