factor polynomial with coefficients 
Based on a prior question it turned out the roots of the polynomial
$$P(z) = z^2-a\,z-\frac{z}{a}+1$$ are determinded by $z_1 = a$ and
$z_2 = 1/a$
Naively I fought the Polynomial can be hence factored by $$P_2(z) =
> (z-a)\,(z-1/a)$$
However, this is wrong. The true factorization is given by  $$P_1(z) =
> (a-z)\,(a\,z-1)$$
It's quite puzzling me where that deviation comes from.

Edit
Really unfortunate:
For Whatever Reason I fought
$$P_1(z)= z+a^2\,z-a\,z^2-a$$
is the same as
$$P_2(z) = z^2-a\,z-\frac{z}{a}+1$$
However, here I had $P_2(z) = \frac{P_1(z)}{-a}$ expecting same factorization for both Polynomials from the program.
The reason for my expectation underlies the fact $P_1$ and $P_2$ have same roots. But their factorization is different? Also what's questionable: why it can't be fixed by multiplying $a$ back.
 A: In your edit the problem is that both polynomial are different. When we divide $$P_1(z)= z+a^2\,z-a\,z^2-a$$ by $a$ we get
$$ \frac{z}{a}+az-z^2-1 $$
This was the error $1$.
Error $2$ - Also if there is a polynomial $ax+b$. If we divide it by $c$ we get $\dfrac{ax+b}{c}$. Remember that if you just divide a expression by some variable/constant the factorization would change. Remember like the case we took factorisation of $ax+b$ won't be same as $\dfrac{ax+b}{c}$. Similarly factorization of$$P_1(z)= z+a^2\,z-a\,z^2-a$$ is not same as factorization of $$ \frac{z}{a}+az-z^2-1 $$
A: Based from the content from the blockquote, here is my answer

Factoring polynomials of the form $$\sum_{i = 0}^{n}a_{n-i}x^{n - i}$$ based on the roots requires the knowledge of the value of $a_{n}$. This is because defining polynomials of degree $n$ requires $n + 1$ conditions. $n$ of them are the roots and $a_{n}$ is the remaining condition. If it is already known that a polynomial is monic, or $a_{n} = 1$, then factoring the roots as $$\prod_{i = 1}^{n}(x - x_{i})$$ is a valid factorization. However, if the polynomial is not monic, factor out $a_{n}$ from all terms of the polynomial. This gives a monic polynomial, scaled by $a_{n}$. Factor out the monic polynomial, then combining all yields the factorization of the original polynomial.
For example, consider the function $f(x) = 2x^{2} + 6x + 4$. Notice that the leading coefficient, $a_{n}$, is equal to $2$. Factoring $2$ from $f$, we have $2(x^{2} + 3x + 2)$. let $g(x) = x^{2} + 3x + 2$. By getting the roots of $g$, we get that the roots are $\{-2, -1\}$. Factoring $g$, we have $(x + 2)(x + 1)$. Remember that this is the factorization of $g$ and $f(x) = 2g(x)$, hence, the factorization of $f$ is $2(x + 2)(x + 1)$.
