This is the euclidian algorithm.
Let $f \in \mathbb{R}[X]$ be polynomial and $z$ be a root. Then $f(z) = 0$, so take $g = (X - z)$. Since $\mathbb{R}[X]$ is euclidian, you find polynomials $q, r \in \mathbb{R}[X]$ such that $f = qg + r$ with $r = 0$ or $\mathrm{deg}(r) < \mathrm{deg}(g)$. But $r(z)= (f-qg)(z) = f(z) - q(z)g(z) = 0$, so $r(z) = 0$. Eitherway, if $r$ wasn't $0$, then $\mathrm{deg} (r) < \mathrm{deg} (g) = 1$, so $\mathrm{deg} (r) = 0$, and $r$ must be constant. Since $r(z)=0$, you have $r=0$ and $f = gq$.
Normally $\mathrm{deg} (0)$ wouldn't be defined to be $0$, but this doesn't make any difference.
Maybe you are looking for a more elementary reasoning. Then you can argue more visually: Let $f_n = f = a_n X^n + a_{n-1}X^{n-1} \ldots + a_0$ be polynomial such that $f(z) = 0$. Then you can take $f_{n-1} = f_n - a_n (X - z)^n$, which has degree one less then $f$ and still satisfies $f_{n-1}(z) = 0$. Continue setting $f_{k-1} = f_k - e(f_k)(X-z)^k$ (where $e(f_k)$ denotes the leading coefficient of $f_k$), noting $\deg f_k = k$ and $f_k(z) = 0$, down to $f_0$ which is constant and by construction satisfies $f_0 (z) = 0$, so $f_0 = 0$. You always subtracted multiples of $X-z$ so $f - q (X-z) = 0$ for some subtractions subsumed in a polynomial $q$. So the result follows.
This is essentially the same as above.