If `P(x)=a_nx^n+a_(n-1)x^(n-1)+cdots+a_1x+a_0`, then you can factor `P` by finding solutions of algebraic equation ` ` `a_nx^n+a_(n-1)x^(n-1)+cdots+a_1x+a_0=0` which can sometimes be quite difficult.
There are formulas for solving equations of degree lower than 5, but there are no formula for solving algebraic equation of degree 5 and higher (it's not that formula has not been found, but it does not exist, it can never be found).
So if `x_1, x_2, ldots, x_n` are solutions to our equation then we can write our polynomial as: `P(x)=(x-x_1)(x-x_2)cdots(x-x_n)`.
If `k_1,k_2,ldots,k_m` are multiplicities of `x_1,x_2,ldots,x_m` respectivly, then we can write `P` as: `P(x)=(x-x_1)^(k_1)(x-x_2)^(k_2)cdots(x-x_m)^(k_m)`.
If you find only one root `x_0` then you can write `P` as: `P(x)=(x-x_0)Q(x)`. you can get polynomial `Q` ` ` by deviding `P` with `(x-x_0).`