Consider this indefinite integral (I'm interested in the interval $x>0$):
$$\int \frac{\sqrt{x+\sqrt{x^2+1}}}{\sqrt{x}\sqrt{x^2+1}}dx$$
By substitution:
$$u=\sqrt{\frac{1}{2}+\frac{1}{2}\sqrt{1+\frac{1}{x^2}}}, \qquad x=\frac{1}{2u \sqrt{u^2-1}}$$
We get a closed form antiderivative:
$$\int \frac{\sqrt{x+\sqrt{x^2+1}}}{\sqrt{x}\sqrt{x^2+1}}dx=\sqrt{2} \tanh^{-1} \sqrt{\frac{1}{2}+\frac{1}{2}\sqrt{1+\frac{1}{x^2}}} +C$$
Now the inverse hyperbolic tangent is real only for the argument in $(-1,1)$. But in our case the argument for all real $x$ is $ > 1$.
How can the function with real values on $x>0$ have a complex antiderivative?
Edit
To be clear, this is the correct antiderivative. I.e. by differentiating it we get the function under the integral.
How would you explain this without appealing to complex analysis, i.e. branches? This is a real valued function for positive $x$, so this can be given as an assignment to a first year calculus student for example
Edit 2
The derivation of the antiderivative after the substitution:
$$\int \frac{\sqrt{x+\sqrt{x^2+1}}}{\sqrt{x}\sqrt{x^2+1}}dx=\sqrt{2} \int \sqrt{\frac{1}{2}+\frac{1}{2}\sqrt{1+\frac{1}{x^2}}} \frac{dx}{\sqrt{x^2+1}}=\sqrt{2} \int u \frac{dx}{\sqrt{x^2+1}}$$
$$\sqrt{x^2+1}=x(2u^2-1)$$
$$dx=-x\frac{2u^2-1}{u(u^2-1)}du$$
$$\frac{dx}{\sqrt{1+x^2}}=-\frac{du}{u(u^2-1)}=\frac{du}{u(1-u^2)}$$
$$\int \frac{\sqrt{x+\sqrt{x^2+1}}}{\sqrt{x}\sqrt{x^2+1}}dx=\sqrt{2} \int \frac{du}{1-u^2}=\sqrt{2} \tanh^{-1} u$$
Consider $$ u=\sqrt{\frac{1}{2}+\frac{1}{2}\sqrt{1+\frac{1}{x^2}}}> \sqrt{\frac{1}{2}+\frac{1}{2}}=1 $$ Assuming your substitutions are correct, the integral becomes $$ \sqrt{2}\int\frac{1}{1-u^2}\,du= \frac{\sqrt{2}}{2}\int\left(\frac{1}{1-u}+\frac{1}{1+u}\right)\,du= \frac{\sqrt{2}}{2}\log\left|\frac{1+u}{1-u}\right|+c $$ You cannot apply the substitution $u=\tanh v$, as $u>1$.