Background
An integral is solved, and I get the following expression:
$$I = \frac12 \ln \left| \frac{u-1}{u+1} \right| - \frac u{u^2 - 1} + C$$
Teacher's solution states that from there:
If we set $u = \sqrt{x / (x+1)}$ then we get $I = \ln \left| \sqrt{|x+1|} - \sqrt{|x|}\right| \pm \sqrt{x(x+1)} + C$
And challenges the student to find their way there, but I can't.
Progress
I've split the log of a fraction into a difference of logarithms, and filled in the suggested substitution, but it stops there. I.e., I have
$$I = \frac12 \ln\left|\sqrt{\frac{x}{x-1}}-1\right| - \frac12 \ln\left|\sqrt{\frac{x}{x-1}}+1\right| - \frac{\sqrt{\frac{x}{x-1}}}{\frac{x}{x-1}-1} + C $$
Question
How is that transition reached?
Here's one way you can try to solve it.
Firstly, we need to identify the domain of the integrand to ensure we preserve it when finding the antiderivative. We can do that by observing the given substitution $\sqrt{\frac{x}{x+1}}$, which has this domain $x\in(-\infty;-1)\cup[0;+\infty)$. Now let's subtitute $u$ and simplify some fractions: $$\frac{1}{2}\ln\left|\frac{\sqrt{\frac{x}{x+1}}-1}{\sqrt{\frac{x}{x+1}}+1}\right|-\frac{\sqrt{\frac{x}{x+1}}}{\left(\sqrt{\frac{x}{x+1}}\right)^2-1}+C$$ $$\frac{1}{2}\ln\left|\frac{\sqrt{\frac{x}{x+1}}-1}{\sqrt{\frac{x}{x+1}}+1}\right|-\sqrt{\frac{x}{x+1}}\cdot\frac{x+1}{x-x-1}+C$$ $$\frac{1}{2}\ln\left|\frac{\sqrt{\frac{x}{x+1}}-1}{\sqrt{\frac{x}{x+1}}+1}\right|+\sqrt{\frac{x}{x+1}}\cdot(x+1)+C$$ Next, we rationalize the denominator and simplify: $$\frac{1}{2}\ln\left|\frac{\sqrt{\frac{x}{x+1}}-1}{\sqrt{\frac{x}{x+1}}+1}\cdot\frac{\sqrt{\frac{x}{x+1}}-1}{\sqrt{\frac{x}{x+1}}-1}\right|+\sqrt{\frac{x}{x+1}}\cdot(x+1)+C$$ $$\frac{1}{2}\ln\left|\frac{\left(\sqrt{\frac{x}{x+1}}-1\right)^2}{\frac{x}{x+1}-1}\right|+\sqrt{\frac{x}{x+1}}\cdot(x+1)+C$$ $$\frac{1}{2}\ln\left|\left(\sqrt{\frac{x}{x+1}}-1\right)^2\cdot(x+1)\right|+\sqrt{\frac{x}{x+1}}\cdot(x+1)+C$$ Now, this is where our domain findings kick in. If we want to separate our radical expressions to have separate radicals for numerator, denominator, we need to add absolute values inside each separate radical to preserve the domain, otherwise they won't exist for negative values of $x$. We do it like so and simplify: $$\frac{1}{2}\ln\left|\left(\frac{\sqrt{|x|}}{\sqrt{|x+1|}}-1\right)^2\cdot(x+1)\right|+\frac{\sqrt{|x|}}{\sqrt{|x+1|}}\cdot(x+1)+C$$ $$\frac{1}{2}\ln\left|\frac{\left(\sqrt{|x|}-\sqrt{|x+1|}\right)^2}{|x+1|}\cdot(x+1)\right|+\frac{\sqrt{|x|}}{\sqrt{|x+1|}}\cdot(x+1)+C$$ We use absolute value properties to simplify further: $$\frac{1}{2}\ln\left(\frac{\left|\left(\sqrt{|x|}-\sqrt{|x+1|}\right)^2\right|}{||x+1||}\cdot|x+1|\right)+\frac{\sqrt{|x|}}{\sqrt{|x+1|}}\cdot(x+1)+C$$ $$\frac{1}{2}\ln\left(\frac{\left(\sqrt{|x|}-\sqrt{|x+1|}\right)^2}{|x+1|}\cdot|x+1|\right)+\frac{\sqrt{|x|}}{\sqrt{|x+1|}}\cdot(x+1)+C$$ $$\frac{1}{2}\ln\left(\sqrt{|x|}-\sqrt{|x+1|}\right)^2+\frac{\sqrt{|x|}}{\sqrt{|x+1|}}\cdot(x+1)+C$$ We can rewrite $x+1=\pm\left(\sqrt{|x+1|}\right)^2$ so they have the same domain and range. Notice the result is $+$ when $x>-1$, $-$ when $x<-1$, and $0$ when $x=-1$ so sign doesn't matter. We use this and logarithm properties to simplify further: $$\ln\left|\sqrt{|x|}-\sqrt{|x+1|}\right|+\frac{\sqrt{|x|}}{\sqrt{|x+1|}}\cdot\pm\left(\sqrt{|x+1|}\right)^2+C$$ $$\ln\left|\sqrt{|x|}-\sqrt{|x+1|}\right|\pm\sqrt{|x|}\cdot\sqrt{|x+1|}+C$$ $$\ln\left|\sqrt{|x|}-\sqrt{|x+1|}\right|\pm\sqrt{|x(x+1)|}+C$$ We can remove the absolute value in $\sqrt{|x(x+1)|}$, because in our domain $x\in(-\infty;-1)\cup[0;+\infty)$ and for this domain the expression inside absolute value is positive anyway, so no need for absolute value. We use absolte value properties in the logarithm's argument and this leads to the desired result: $$\ln\left|\sqrt{|x+1|}-\sqrt{|x|}\right|\pm\sqrt{x(x+1)}+C$$ I hope this helps! :)