Can $\int_0^1\frac{1+x^{2i}}{x^i(1+x^2)}dx $ be Evaluated Using Differentiating Under the Integral? I'm trying to solve:
$$\int_0^1\frac{1+x^{2i}}{x^i(1+x^2)}dx $$
I don't know complex analysis so I tried using differentiating under the integral somehow to solve the integral but to no avail. I've tried:
$$I(a)=\int_0^1\frac{1+a^2x^{2i}}{x^i(1+x^2)}dx$$
$$I(a)=\int_0^1\frac{1+e^ax^{2i}}{x^i(1+x^2)}dx$$
Neither of which helped. I've tried setting up some differential equations using like using the second variable insertion, I was able to get:
$$I(a)-I'(a)=\int_0^1\frac{1}{x^i(1+x^2)}dx$$
Which seemed promising, but didn't lead anywhere.
Would be appreciated if someone could solve the integral using differentiating under the integral or other methods (except Complex Analysis I don't know residues and whatnot yet).
$i$ is the imaginary unit
 A: Assuming $a\in(-1,1)$, it is not difficult to prove
$$ f(a)=\int_{0}^{1}\frac{x^a+x^{-a}}{x^2+1}\,dx =\frac{1}{2}\int_{0}^{+\infty}\frac{x^a+x^{-a}}{x^2+1}\,dx = \int_{0}^{+\infty}\frac{x^a}{x^2+1}\,dx= \frac{\pi}{2\cos\frac{\pi a}{2}},$$
for instance by setting $\frac{1}{x^2+1}=u$, then invoking Euler's Beta function and the reflection formula for the $\Gamma$ function. Assuming that $x^i$ is defined as $\cos\log x+i\sin\log x$ for $x\in\mathbb{R}^+$, and similarly $x^z$ is defined as $\exp(z\operatorname{Log} x)$, with $\text{Log}$ being the principal determination of the complex logarithm, we have
$$ \int_{0}^{1}\frac{x^i+x^{-i}}{x^2+1}\,dx = \frac{\pi}{2\cosh\frac{\pi}{2}} $$
since $f(z)$ is a holomorphic function in the region $|z|<1$ and it is continuous in a neighbourhood of $z=i$.
A: Do you agree that if I set $x=e^{-t}$ I get:
$$\int^1_0 \frac{1+x^{2i}}{x^i (1+x^2)}\,dx = \int^\infty_0 \frac{\cos(t)}{\cosh(t)}\,dt$$
by using the simple "complex" formula $2\cos(t) = e^{it}+e^{-it}$? We see immediately that the answer is real. 
If you accept that, then from this answer you see how many methods there are to evaluate the latter (it is  easy when using little results from complex analysis though). The answer is $$\frac{\pi}{2\cosh(\pi/2)}$$  
