This stems from the fact that the set of nth roots of the unit circle is a cyclic group isomorphic to Zn so taking powers of an nth root gives an nth root so summing the powers of all of them is the same sum ( so 0) except when the powers are multiples of n then in that case it gives 1+1+..+1=n ( the order of each element divides the cardinal of the group, in this case its exactly n for each element stemming from a fact I mention below)
Oh dear