calculus complex number question related to geometric interpretation of $w^n = 1$ 
Let $p_0,p_1 ,... ,p_{n-1}$ be vertices of a regular n-gon inscribed in unit-circle. Using
  complex numbers; Prove that:
$n = [p_0p_1]*[p_op_2]*...*[p_0p_{n-1}]$ where $[p_0p_i]$ means the
  length of the segment line between these two points.

My teacher solved like this:
By knowing the properties of $w^n = 1$ (where $w$ is complex number and nth root of 1) we get that the right hand side equals to $|1-w|*|1-w^2| * ... * |1-w^{n-1}|$ where || denotes the magnitude of the complex number.
Now lets think that all the possible $w$s and 1 are answers to $z^n -1=0$ so we get: 
$z^n -1 = (z-1) (z-w) (z-w^2) ... (z-w^{n-1})$
By dividing both sides to $z-1$ and assuming that $z \neq 1$ we get
$\frac{z^n -1}{z-1} = (z-w) (z-w^2) ... (z-w^{n-1})$
so
$(z^{n-1} + z^{n-2} + ... + 1) =(z-w) (z-w^2) ... (z-w^{n-1})$
By assigning $z=1$ we get that $n = |1-w|*|1-w^2| * ... * |1-w^{n-1}|$
My problem is that we assumed $z\neq1$ and then used $z=1$. How is this possible? I asked my teacher and he couldn't give an acceptable answer.
So is this answer correct? If not, what is the right answer?
 A: The proof is correct.

My problem is that we assumed $z\neq1$

That was indeed used (but maybe not sufficiently explained) to prove that:
$$z^{n-1} + z^{n-2} + ... + 1 =(z-w) (z-w^2) ... (z-w^{n-1}) \tag{1}$$
The derivation is equivalent to $\,(z-1)P(z) = (z-1)Q(z) \implies P(z)=Q(z)\,$, which follows because $\,P(z)=Q(z)\,$ for infinitely many values of $\,z \ne 1\,$, so the polynomial $\,P(z)-Q(z)\,$ has infinitely many roots, and must therefore be the zero polynomial.

and then used $z=1$.

Note that $\,(1)\,$ is an algebraic (in fact, polynomial) identity, which holds for all values of $\,z\,$, so it is perfectly legitimate to now substitute $\,z=1\,$ in order to get the end result.
A: Note that $z^n-1 = (z-1)(1+z+\cdots+z^{n-1})$. The expression on the right is a polynomial in $z$, hence continuous for all $z$, in particular $z=1$. The r.h.s. remains a polynomial when you divide both sides by $z-1$. Thus, after dividing, it's incorrect to just plug in $z=0$ to the left side as you'll get 0/0. But you can evaluate $\lim_{z\rightarrow 1}$ of the expression, OR, derive via long-division the expression $1+z+\cdots+z^{n-1}$. 
In complex analysis, this kind of behavior is referred to as a removable singularity, as it only looks like a singularity, but admits a perfectly fine value when evaluated via a limit.  
