The spell Fireball would have effect 2 for one of it's spell effects (Spell.DBC fields 71-73, there's up to 3 different effects per spell).
The spell effect callbacks are registered in pEffect SpellEffects[TOTAL_SPELL_EFFECTS] as function pointers. These are stored in SpellEffects.cpp; that one at index 2 is registered as:
&Spell::EffectSchoolDMG, // 2 SPELL_EFFECT_SCHOOL_DAMAGE
When the server wants to do the effect of a spell, it simply calls the function located at SpellEffects[the index of the spell effect], in this case SpellEffects[2], which is Spell::EffectSchoolDMG.
The exact code is in Spell::HandleEffects:
if(eff < TOTAL_SPELL_EFFECTS)
{
(*this.*SpellEffects[eff])(i);
}