This is actually a nontrivial question, at least compared to the rest of intermediate algebra in which one is first exposed to factoring polynomials. One can verify the fact directly by solving the general quadratic and then plugging into the factorization, but this is really a more general fact that applies to all polynomials for common reasons. There are a few key elements to know about.
One element is long division. We can long divide one polynomial by another, and wind up with a so-called "remainder" in the end. If $f(x)$ is a polynomial and $g(x)$ is another, there exists a unique quotient $q(x)$ and remainder $r(x)$ such that $f(x)=q(x)g(x)+r(x)$ with $\deg r<\deg g$. This can be compared to the case for integers: for all integers $n$ and $m$ there exists a quotient $q$ and a remainder $r$ such that $n=qm+r$ with $r<m$. The division algorithm is the same.
A second element is that roots correspond to linear factors. That is, if $z$ is a root of any polynomial $f(x)$, then we can factor $f(x)=q(x)(x-z)$ for some polynomial $q(x)$. This fact can be deduced from the division algorithm. Write $f(x)=q(x)(x-z)+r$ for some quotient $q(x)$ and remainder value $r$. (The only way for $\deg r$ to be less than $\deg(x-z)=1$ is if $r$ is a constant.) Then plug in the value $x=z$ and get $f(z)=q(z)(z-z)+r$. Since $f(z)=0$, this simplifies to $0=r$, so we have deduced $f(x)=q(x)(x-z)$ for some $q(x)$. Note that the coefficients of $q(x)$ may be more complicated than the ones we started with in $f(x)$.
Thus, given a root $z$ of $f(x)$, we can factor $f(x)=q(x)(x-z)$. Then, finding another a root of $q(x)$, we can factor $q(x)$ that way, and so on. We can keep doing this until we end up with a constant times the last linear factor. Thus we have $f(x)=a(x-z_1)(x-z_2)\cdots(x-z_n)$ for some values $a,z_1,\cdots,z_n$. The values $z_1,\cdots,z_n$ are all roots of $f(x)$ (plug one in and see what happens in the factorization) and $a$ is the leading coefficient (if you expand the factorization back out, the leading term is $ax^n$).
Note that the fundamental theorem of algebra guarantees every nonconstant polynomial has a root, possibly a complex number. So the procedure outlined here won't get "stuck."