An exact study of phase transitions in mean field Potts models