In potassium sulfate (K₂SO₄):
1) potassium has oxidation number +1, because it is metal in first group of Periodic table of elements.
2) sulfur has oxidation number +6.
3) oxygen has oxidation number -2, because it gain electrons from potassium and sulfur.
Compound has neutral charge: +1· 2 + 6 + (-2) · 4 = 0.