Is there an easy way to justify: $$x(x-1)(x+1) \equiv x(x^2-1) \Rightarrow (x-1)(x+1) \equiv x^2-1,$$ even for $x=0$? I seemingly have to divide by $x$ which should place the restriction $x \neq 0$ on the final result. Does this work only for polynomials?
EDIT: thank you for the comments, in light of the suggestions to do case work I'll update with a more involved example to demonstrate why I am not looking for this approach. I'm sorry to move the goal posts a bit, let me know if this should be a new question.
Let's suppose that $w=e^{2\pi i/n}$ where $n$ is an integer. Let's say I've deduced that $$(z-1)(z-w)(z-w^2)...(z-w^{n-1}) \equiv (z-1)(1+z+z^2+...+z^{n-1}).$$
I want to conclude here that $(z-w)(z-w^2)...(z-w^{n-1}) \equiv 1+z+z^2+...+z^{n-1}$ including $z=1$ - it's not easy to verify by cases anymore since I am actually trying to use this factorisation to show that $(1-w)(1-w^2)...(1-w^{n-1})=n$.
This is a consequence of the fact that a nonzero polynomial whose coefficients are complex numbers (or in any integral domain) has no more roots than its degree. This quickly yields what we seek, viz.
Theorem $ $ If $\,f,g,h\,$ are polynomials with coefficients in $\Bbb C$ (or any infinite field C) and $\,f\neq 0\,$ then
$$\begin{align} f(x) g(x) &= f(x) h(x)\ \ \text{for all }\, x\in C\\ \Rightarrow\ \ g(x) &= h(x)\qquad\ \ \text{for all }\, x\in C\end{align}$$
Proof $\ $ Since $\,f\neq 0\,$ it has only finitely many roots (at most $\deg f).\,$ Thus there are infinitely many nonroots $\,c\in C\,$ where $\,0\neq f(c)\,$ so it is cancellable, thus
$$f(c)\,(g(c)-h(c)) = 0\,\Rightarrow\, g(c)-h(c) = 0$$
Thus the polynomial $\,g(x)-h(x)\,$ has infinitely many roots $\,x = c\,$ so it is identically zero.
Remark $ $ It fails for finite fields, e.g. over $\,\Bbb Z_3 = $ integers $\!\bmod 3\,$ we have $ x(x^2) = x(1)\,$ for all $\,x,\,$ but $\, x^2 = 1\,$ is false at $\,x = 0$.