How do I go about integrating this function:
$$\int{\sqrt{\tan{x}}} \,dx$$
Subbing $x=\arctan{u^2}$, $dx = (2 u)/(1+u^4) du$ produces
$$2 \int du \frac{u^2}{1+u^4}$$
It turns out that
$$1+u^4=(1+\sqrt{2} u+u^2)(1-\sqrt{2} u+u^2)$$
so that we may invoke partial fractions. The result is that the integral becomes
$$\frac1{\sqrt{2}} \int du \left (\frac{u}{1-\sqrt{2} u+u^2} - \frac{u}{1+\sqrt{2} u+u^2} \right )$$
which is equal to
$$\frac1{\sqrt{2}} \int du \left (\frac{u-\frac1{\sqrt{2}}}{\frac12 + \left (u-\frac1{\sqrt{2}}\right )^2} - \frac{u+\frac1{\sqrt{2}}}{\frac12 + \left (u+\frac1{\sqrt{2}}\right )^2} \right )\\+ \frac12 \int du \left (\frac1{\frac12 + \left (u-\frac1{\sqrt{2}}\right )^2}-\frac1{\frac12 + \left (u+\frac1{\sqrt{2}}\right )^2} \right )$$
which evaluates to
$$\frac{1}{2 \sqrt{2}} \log{\left (\frac{1-\sqrt{2} u+u^2}{1+\sqrt{2} u+u^2} \right )} -\frac1{\sqrt{2}} \arctan{\left (\frac1{u^2} \right )}+C$$
Back substitute $u=\sqrt{\tan{x}}$ and you are done. Note that there is some simplification that may be made by observing that
$$\frac1{\tan{x}}=\tan{\left (\frac{\pi}{2}-x \right )}$$
Letting $y=\sqrt {\tan x}$ transforms the integrand into a rational function. $$ \begin{aligned} \int \sqrt{\tan x} d x = & \int y \cdot \frac{2 y d y}{1+y^4} \\ = & \int \frac{2}{y^2+\frac{1}{y^2}} d y \\ = & \int \frac{\left(1+\frac{1}{y^2}\right)+\left(1-\frac{1}{y^2}\right)}{y^2+\frac{1}{y^2}} d y \\ = & \int \frac{d\left(y-\frac{1}{y}\right)}{\left(y-\frac{1}{y}\right)^2+2}+\int \frac{d\left(y+\frac{1}{y}\right)}{\left(y+\frac{1}{y}\right)^2-2} \\ = & \frac{1}{\sqrt{2}}\left[\tan ^{-1}\left(\frac{y-\frac{1}{y}}{\sqrt{2}}\right)-\tanh^{-1} \left(\frac{y+\frac{1}{y}}{\sqrt{2}}\right)\right]+C \\ = & \frac{1}{\sqrt{2}}\left[\tan ^{-1}\left(\frac{\sqrt{\tan x}-\sqrt{\cot x}}{\sqrt{2}}\right)-\tanh ^{-1}\left(\frac{\sqrt{\tan x}+\sqrt{\cot x}}{\sqrt{2}}\right)\right]+C \end{aligned} $$