To be honest, primary school was long ago and I can't remember if I was taught any rule. I know when to use "s" or "z" from everyday usage, I presume.
we use an "s" in such verbs as atrasar, alisar, analisar, avisar, pesquisar, paralisar, arrasar, extravasar, frisar, etc.
and a "z" is used in agonizar, amenizar, batizar, concretizar, simpatizar, utilizar, realizar, civilizar, etc.
For those who are learning Portuguese as a foreign language, this must be a hard nut to crack. Is there any rule to make things easier for the student?