The book I'm reading introduces polynomials over a field and proves the statement that a polynomial of degree $n$ has at most $n$ zeros. They do this by using division algorithm and induction.
Then they make the following remark:
This is not true for polynomial over arbitrary rings. For instance $x^2 + 7 \in \mathbb{Z}_8$ has roots $1,3,5,$ and $7$.
My question: what fails in the previous proof for arbitrary rings? They just made that remark and moved on.
Edit -- Proof (from Gallian):
We proceed by induction on $n$. Clearly, a polynomial of degree $0$ over a field has no zeros. Now suppose that $f(x)$ is a polynomial of degree $n$ over a field and $a$ is a zero of $f(x)$ of multiplicity $k$. Then, $f(x)=(x-a)^kq(x)$ and $q(a) \neq 0$. Note we have $\text{deg }f = n = k + \text{deg }q$. If $f(x)$ has no zeros other than $a$, we are done. On the other hand, if $b \neq a$ and $b$ is a zero of $f(x)$, then $0=f(b)=(b-a)^kq(b)$ so that $b$ is a zero for $q(x)$ with the same multiplicity it has for $f(x)$. By the Second Principle of Mathematical Induction, we know that $q(x)$ has at most deg $q(x)=n-k$ zeros, counting multiplicity. Thus, $f(x)$ has at most $k + n -k = n$ zeros, counting multiplicity.
Usually, you can go from a factorization like $(x-1)(x-2)=0$ to the pair of equations $x-1=0$ and $x-2=0$ to get your solutions. This uses the zero product property, which says that if $AB=0$ then either $A$ or $B$ are equal to zero. This fails over arbitrary rings. For example, in $\mathbb{Z}/8\mathbb{Z}$, the zero product property fails because $2\cdot 4=4\cdot 4=4\cdot 6=0$. So if we want to solve $(x-1)(x-7)=0$, then there are six things that can happen. Either: $$ (1)\;\;\;\;x-1 = 0\;\;\textrm{or}\;\; x-7=0\\ (2)\;\;\;\;x-1 = 2\;\;\textrm{and}\;\; x-7=4\\ (3)\;\;\;\;x-1 = 4\;\;\textrm{and}\;\; x-7=2\\ (4)\;\;\;\;x-1 = 4\;\;\textrm{and}\;\; x-7=4\\ (5)\;\;\;\;x-1 = 4\;\;\textrm{and}\;\; x-7=6\\ (6)\;\;\;\;x-1 = 6\;\;\textrm{and}\;\; x-7=4 $$ The only ones that can happen are (1), (2) and (5) using $x=1,7$ and $x=3$ and $x=5$ respectively. Therefore, the solutions are $1,7,3,5$. Note that the extra zeros correspond both to zero divisors of the base-ring, as well as two different factorizations in the polynomial ring.
In general, if $R$ has zero divisors, then $R[x]$ will not have unique factorization since there is a correspondence between zeros and factors of a polynomial. The zero divisors can ensure that there are "too many" factors.
For instance, let $a,b$ be zero divisors and let $c,d$ be any other values so that $a-b=c-d$. Set $s=a+d=b+c$. Consider the polynomial $p(x)=(x-c)(x-d)$. Clearly $x=c,d$ are roots. But, furthermore, $p(s)=(b+c-c)(a+d-d)=ab=0$. So $x=s$ is also a root, and you can check that $x=t$, where $t=c+d-s$, is also a root. We then get $p(x)=(x-c)(x-d)=(x-s)(x-t)$.