<s>[INST] How to factor $(1+\frac{1}{x})(-\frac{6}{x^2})+(\frac{6}{x^3})(1+\frac{1}{x})^2$ to get $\frac{6}{x^3}(1+\frac{1}{x})(1+\frac{2}{x})$? 
How can I factor this: $$\left(1+\frac{1}{x}\right)\left(-\frac{6}{x^2}\right)+\left(\frac{6}{x^3}\right)\left(1+\frac{1}{x}\right)^2$$
in order to get this result: $$\frac{6}{x^3}\left(1+\frac{1}{x}\right)\left(1+\frac{2}{x}\right)$$

I have tried to factor out the $(1+\frac{1}{x})$ use the distributive property, and failed multiple times. Every online calculator I tried gives me different results.
 [/INST] My first thought was to factor out the $\frac 6{x^2}$ but yours was to factor out the $1 + \frac 1x$.  So we'll do it your way:
Factor out the $1 + \frac 1x$ and we get
$(1 + \frac 1x) (\frac {-6}{x^2} + \frac 6{x^3}(1 + \frac 1x))$.
Now factor out the $\frac 6{x^2}$ to get:
$\frac 6{x^2}(1 + \frac 1x) (-1 + \frac 1x(1 + \frac 1x))$
$\frac 6{x^2}(1 + \frac 1x)(-1 + \frac 1x + \frac 1{x^2})$
now, I can struggle with trying to factor $(-1+\frac 1x + \frac 1{x^2})$[1] but I must point out that if you claimed factorization and my demonstrated factorization were both true we'd have $-1 + \frac 1x + \frac 1{x^2} = \frac 1x(1+\frac 2x)$.  WHich it doesn't.
Are you sure the question wasn't to solve for  the $x$ where it does factor to that?  In which case we'd solve for $-1 + \frac 1x + \frac 1{x^2} = \frac 1x(1+\frac 2x)$ or $-1 = \frac 1{x^2}$ which is $x =\pm i$ if we are allowed to use complex numbers...  So... I guess that wasn't the question.
[1] Long story short; by the rational roots theorem we can't.
</s>