Dividing one polynomial by another
First step: By which monomial should you multiply $x^2-2x+1$ in order to get some polynomial with the same leading coefficient as $x^3-12x^2-42$? That's easy: $x$. So, now you do$$x^3-12x^2-42-x\times(x^2-2x+1)=-10x^2-x-42.$$Now, the same question: By which monomial should you multiply $x^2-2x+1$ in order to get some polynomial with the same leading coefficient as $-10x^2-x-42$? Now, the answer is $-10$. So, now you do$$-10x^2-x-42-(-10)\times(x^2-2x+1)=-21x-32.$$Now the degree is less than the degree of $x^2-2x+1$ and therefore there's nothing else to do: the quotient is $x-10$ and the remainder is $-21x-32$.
The long division algorithm is a way of taking the numerator, and split it into multiples of the denominator, separate those out into their own fractions, and simplify away the denominator. For instance, we have $x(x^2 - 2x+1) = x^3-2x^2+x$, so $$ \frac{x^3 - 12x^2 + 0x-42}{x^2-2x+1} = \frac{(x^3-2x+x) - 10x^2 - 1x-42}{x^2-2x+1}\\ = \frac{x(x^2-2x+1)}{x^2-2x+1} + \frac{-10x^2-1x-42}{x^2-2x+1}\\ = x + \frac{-10x^2-1x-42}{x^2-2x+1} $$ So now we've gotten an $x$, and we're left with a new fraction where the degree of the numerator has gone down by 1 compared to where we started. We can keep going, as long as the degree of the numerator is larger than or equal to the degree of the denominator, which in this case means one more step. This time, we see that $-10(x^2-2x+1) = -10x^2+20x-10$ so $$ \frac{-10x^2-1x-42}{x^2-2x+1} = \frac{(-10x^2+20x - 10) -21x-32}{x^2-2x+1}\\ = -10 + \frac{-21x-32}{x^2-2x+1} $$ At this point the algorithm stops, and we're left with $$ \frac{x^3 - 12x^2 + 0x-42}{x^2-2x+1} = x + \frac{-10x^2-1x-42}{x^2-2x+1} = x -10 + \frac{-21x-32}{x^2-2x+1} $$ This is exactly the long division algorithm, written out with regular fraction notation. If you do the long division algorithm the normal way, you will recognize the different numerators all round, but that technique is designed for ease of calculation, not transparency. So it's difficult to tell what is really going on unless you already know.