(x^2-x-12)/(x-4)
This can be done as a "normal" division.
First note that the first term of the dividend is x^2 and the one of divisor is x. If you divide one by the other, you will obtain x.
x^2-x-12 | ul (x-4)
color(white)(..................... )x
Then you multiply x by x-4 and subtract the result to the dividend:
color(white)(...)x^2-x-12 | ul (x-4)
-x^2+4x color(white)(.........) x
----
color(white)(. ..)0-3x-12
Now, you must repeat the same with -3x-12 which gives 3:
color(white)(...)x^2-x-12 | ul (x-4)
-x^2+4x color(white)(.........) x-3
----
color(white)(. ..)0-3x-12
color(white)(. ..)0+3x+12
----
color(white)(. ..)0color(white)(. ..)0color(white)(. ..)0