How to integrate $\int_{0}^{\infty} \frac{dx}{\sqrt{x}(x^{2}+1)}$ using the residue theorem. He was doing this integral using the formula 
$$\int_{0}^{\infty} \frac{dx}{\sqrt{x}(x^{2}+1)}= \frac{2\pi i}{1-e^{-2\pi i\alpha}}(\sum(Res(\frac{F(z)}{z^{\alpha}};z_{k})))$$ where $F(z)=\frac{1}{(x^{2}+1)}$, $\alpha=\frac{1}{2}$ and $z_{k}$  is a pole of $F(z)$. 
The poles of $F (z)$ are $i$ and $-i$ which are of order $1$. But it has not given me the answer which is $\frac{\pi}{\sqrt{2}}$. 
I think my problem is calculating the residues or operate for to give me the answer. Any hint is appreciated.
 A: Hint.  You will need to consider which branch you take for the complex square root.  In particular,
$$(-i)^{1/2}=e^{-\pi i/4}$$
gives you the wrong answer, but
$$(-i)^{1/2}=e^{3\pi i/4}$$
gives you the right answer.  If you look carefully at the formula you are using where it was first stated, hopefully you will find an indication of what branch of $z^\alpha$ is to be used.
A: Here are some relevant hints including basic complex number arithmetic. 
Put $$\sqrt{z} = \exp(1/2\log z)$$
where  the logarithm  has the  branch cut  on the  positive  real axis
(argument from zero to $2\pi$.)

Use a  keyhole contour with the slot  of the key on  the positive real
axis.   On    the   circular   part    of   the   contour    we   have
$1/\sqrt{z}/z^2\in\Theta(R^{-5/2})$ and  since $\lim_{R\to\infty} 2\pi
R  \times R^{-5/2} =  0$ the  contribution from  the circular  arc is
zero.

This leaves the contribution above and below the positive real axis.
Above the real axis we get
$$\int_0^\infty \frac{1}{\sqrt{x} (x^2+1)} dx$$
with $\sqrt{x}$ being the real square root function.
Below the real axis we have
$$\int_\infty^0 
\frac{1}{\exp(1/2\log x + 1/2\times 2\pi i)(x^2+1)} dx$$ 
which is
$$- e^{-\pi i} \int_0^\infty \frac{1}{\sqrt{x} (x^2+1)} dx$$
with the square root again being the real square root function.
Collecting the two contributions we have
$$(1-e^{-\pi i}) 
\int_0^\infty \frac{1}{\sqrt{x} (x^2+1)} dx
\\= 2\pi i 
\left(\mathrm{Res}\left(\frac{1}{\sqrt{z} (z^2+1)}; z=i\right)
+\mathrm{Res}\left(\frac{1}{\sqrt{z} (z^2+1)}; z=-i\right)\right).$$
This implies that
$$\int_0^\infty \frac{1}{\sqrt{x} (x^2+1)} dx
= \pi i
\left(\frac{1}{\sqrt{i} (+2i)}
+ \frac{1}{\sqrt{-i} (-2i)}\right)
\\ = \pi i
\left(\frac{1}{e^{i\pi/4} (+2i)}
+ \frac{1}{e^{3i\pi/4} (-2i)}\right)
= \pi i e^{-i\pi /4}
\left(\frac{1}{2i} - \frac{1}{2i e^{i\pi/2}}\right)
\\= \pi i e^{-i\pi /4}
\left(- i\frac{1}{2} + \frac{1}{2}\right) 
= \frac{\pi}{\sqrt{2}} i e^{-i\pi /4}
\left(- i\frac{\sqrt{2}}{2} + \frac{\sqrt{2}}{2}\right)
\\ = \frac{\pi}{\sqrt{2}} i e^{-i\pi /4} e^{-i\pi /4}
= \frac{\pi}{\sqrt{2}} i e^{-i\pi /2}
= \frac{\pi}{\sqrt{2}} i (-i) \\
= \frac{\pi}{\sqrt{2}}.$$
Addendum. If we want to be  extra careful about it we also have to
check  the integral along  the miniature  circle of  radius $\epsilon$
enclosing    the    origin,    which    is    on    the    order    of
$2\pi\epsilon/\sqrt{\epsilon}=     2\pi\sqrt{\epsilon}\to     0$    as
$\epsilon\to 0.$
