Factoring a Cubic Polynomial
By the Rational Zero Theorem all the rational roots of $x^{3}-12x+9$ must have a numerator which is a factor of $9$ and a denominator which is a factor of $1$. Therefore they have to be of the form $\frac{9}{1}=9$ or $\frac{3}{1}=3$. Let $f(x)=x^{3}-12x+9$. Since $f(9)=630$ and $f(3)=0$, $3$ is a root of $f(x)$. So it can be factored as
$x^{3}-12x+9=(x-3)\left( ax^{2}+bx+c\right) =ax^{3}+\left( b-3a\right) x^{2}+\left( c-3b\right) x-3c$
Comparing coefficients we get
$a=1,b-3=0\iff b=3,-3c=9\iff c=-3$.
Then
$x^{3}-12x+9=(x-3)\left( x^{2}+3x-3\right) $.
PS. Or we could apply Ruffini's rule to find the coefficients of $ax^{2}+bx+c$.
PPS. As commented by user1827 "The rational zero theorem" also permits "$1/1=1$ and $-9,-3,-1$. But they are not zeros."
Of course, since $f(3)=0$ we can factor $f(x)$ rightaway, without taking into consideration all the remaining possibilities.
It's not a special case of any general factorization rule (except perhaps the Rational Root Test).
However, one easy ad-hoc way to derive the factorization is to notice
$\rm\quad\quad\quad\ f(x) + 3\:(x-3)\ =\ x\: (x^2 - 9) $
Thus $\rm\ \ f(x)\ =\ (x-3)\ (x\: (x+3) - 3)$
One way to see that is that $x=3$ is a root of $x^3 - 12x + 9$. So $(x-3)$ will be a factor (by the Factor Theorem).
Now you can try to get $x-3$ somehow.
One way you can do that is to rewrite
$$x^3-12x + 9 = x^3 - (3^3 - 3^3) - 12(x - 3+3) + 9$$ $$ = x^3 - 27 + 27 - 12(x - 3) - 36 + 9 = x^3 - 27 - 12(x-3) + (9 -36 + 27)$$ $$ = (x-3)(x^2+3x+9) - 12(x-3) = (x-3)(x^2+3x-3) $$
Here we used the fact that $x^3 - a^3 = (x-a)(x^2 + ax + a^2)$
In general, if $r$ is a root of $f(x) = a_{n}x^n + a_{n-1}x^{n-1} + \dots + a_{0}$, then $f(x) - f(r) = f(x)$ gives us a way to factorize $f(x)$ as $(x-r)g(x)$.
$$f(x) = a_{n}x^n + a_{n-1}x^{n-1} + \dots + a_{0} - (a_{n}r^{n} + a_{n-1}r^{n-1} + \dots +a_{0})$$
$$ = a_{n}(x^n - r^n) + a_{n-1}(x^{n-1} - r^{n-1}) + \dots + a_{1}(x-r)$$
Just like $x^3 - a^2 = (x-a)(x^2 + ax + a^2)$ we have that
$$x^n - r^n = (x-r)(x^{n-1} + rx^{n-1} + \dots + r^{n-1})$$
and so
$$f(x) = (x-r) (a_{n}(x^{n-1} + rx^{n-2} + \dots + r^{n-1}) + a_{n-1}(x^{n-2} + \dots +r^{n-1}) + \dots + a_1)$$
Once we know a root, we can also try using Polynomial Long Division to get the other factor.
For cubics, the roots can be found without the need to guess. Check this out: Cardano's Method.
Does that help?