Rule for factoring out variable in limit I am a bit confused about the proper way to calculate the limit of a function by factoring out the variable that strives for infinity.

If you have this:

$\lim_{x\rightarrow \infty } \sqrt{x} \left(\sqrt{x+1}-\sqrt{x}\right)$

for some reason you cannot do this:

$ = \lim_{x\rightarrow \infty } \sqrt{x} \left(\sqrt{x(1+ \dfrac{1}{x})}-\sqrt{x}\right) = \lim_{x\rightarrow \infty } \sqrt{x} \left(\sqrt{x}-\sqrt{x}\right) = 0$

but rather should do this:

$ = \lim_{x\rightarrow \infty } \sqrt{x} \frac{\left(\sqrt{x+1}-\sqrt{x}\right)\left(\sqrt{x+1}+\sqrt{x}\right)}{\left(\sqrt{x+1}+\sqrt{x}\right)} = \lim_{x\rightarrow \infty } \sqrt{x} \frac{x+1-x}{\left(\sqrt{x+1}+\sqrt{x}\right)} = \lim_{x\rightarrow \infty } \frac{\sqrt{x}}{\sqrt{x(1+\frac{1}{x})}+\sqrt{x}} = \lim_{x\rightarrow \infty } \frac{\sqrt{x}}{2\sqrt{x}} = \frac{1}{2}$

Why is it legit to factor out $x$ in the second approach but not in the first one? Is there a general rule for when you are allowed to do so and when not?
We look at the calculation at the end of the OP that you labelled as legitimate. It is in fact not legitimate, but happens to give the right answer. We should not write
$$\lim_{x\to\infty}\frac{\sqrt{x}}{\sqrt{x\left(1+\frac{1}{x}\right)}+\sqrt{x}}=\lim_{x\to\infty}\frac{\sqrt{x}}{2\sqrt{x}}.\tag{????}$$
For if we do that, we have let $x\to\infty$ in part but not all of our expression. We should instead do the correct algebraic manipulation (cancel the $\sqrt{x}$) and write
$$\lim_{x\to\infty}\frac{\sqrt{x}}{\sqrt{x\left(1+\frac{1}{x}\right)}+\sqrt{x}}=\lim_{x\to\infty}\frac{1}{\sqrt{1+\frac{1}{x}}+1}.$$
Now we can safely let $x\to\infty$, with full control over what is going on.
Although $\lim_{x \to \infty} \sqrt{x} (3-3) = \lim_{x \to \infty} \sqrt{x} \cdot 0 =0$, in your case you have $\lim_{x \to \infty} = \sqrt{x}(\sqrt{x} - \sqrt{x}) \neq \lim_x \sqrt{x} \cdot (\lim_x \sqrt{x} - \sqrt{x})$ because $\infty \cdot 0 $ is an indeterminate form. Also $\lim_x (\sqrt{x} - \sqrt{x}) \neq \lim_x \sqrt{x} - \lim_x \sqrt{x}$ because \infty - \infty is an indeterminate form too.