Proof $\Re{\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\frac{1}{\tan^{2n}(x)+1}dx}=\frac{\pi}{2},\forall n \in \mathbb{R}$ I was solving the integral $$\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\frac{1}{\tan^6(x)+1}dx$$ and here's my solution:
Let $I = \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\frac{1}{\tan^6(x)+1}dx$, then $$I=2\int_{0}^{\frac{\pi}{2}}\frac{1}{\tan^6(x)+1}dx.$$ Subs. $u=\tan x,dx=\frac{1}{1+u^2}du$.
$$I = 2\int_{0}^{\infty}\frac{1}{(1+u^6)(1+u^2)}du$$
$$I=2\left(\int_{0}^{1}\frac{1}{(1+u^6)(1+u^2)}du +  \int_{1}^{\infty}\frac{1}{(1+u^6)(1+u^2)}du\right).$$
On the first integral, $u \mapsto u^{-1}$, ending with $$I=2\int_{1}^{\infty}\frac{du}{1+u^2}=\frac{\pi}{2}.$$
Using the same approach, I was able to prove that the equality holds for all $n\in \mathbb{Z}$. Going beyond, and using Wolfram Alpha, the equality seems to hold for all reals $n$, but only for the real part. So, here's my question: 

Claim. Let $$\mathcal{I}=\Re{\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\frac{1}{\tan^{2n}(x)+1}dx}.$$ Then, $\mathcal{I}=\frac{\pi}{2}, \forall n \in \mathbb{R}.$

First of all: Is the Claim true?
If positive, can I prove it using the same methods?
 A: There will be no problem if you write $(\tan^2 x)^n$. But you can try to insist on using the power $s:=2n$. If you were talking about $$2∫_0^{\pi/2}\frac{dx}{\tan^s x + 1}$$ there would be no issue using your proof still, but the integral $$J:=∫_{-\pi/2}^0\frac{dx}{\tan^s x + 1} $$
can have an imaginary part. There could be one answer for each branch of $x^s=e^{s\log x }$. Since $x<0$, these branches are
$$ e^{s \log |x| + (2k+1)πis } = |x|^s e^{(2k+1)π i s},\quad k ∈ \mathbb Z$$
giving
$$ \frac{1}{\tan^s x + 1} = \frac{1}{e^{(2k+1)πi s} \tan^s(-x) + 1}$$
If you try to go through the same proof, you end up with
$$ J = ∫_0^1 \frac{v^s}{(v^s + e^{(2k+1)iπ s})(v^2+1)} + \frac{1}{(e^{(2k+1)iπ s}v^s + 1)(v^2+1)} dv$$
One can check that
$$ \frac{v^{2s} \exp(ix) + 2v^s + \exp(ix)}{[v^s+\exp(ix)][v^s \exp(ix)+1]} = 1 -2 i \sin(x) (v^{2s} + 2 v^s \cos(x) + 1)$$
with $x = (2k+1)π i s$, this verifies that regardless of the branch cut used to define $\tan^s x$ for $x<0$,
$$\Re∫_{-\pi/2}^0 \frac{1}{\tan^s x + 1}\ dx  = \frac{π}{4} $$
A: Your integral always equals
$$2\int^\infty_0\frac1{(1+u^{2n})(1+u^2)}du$$
$$=2\int^1_0 \frac1{(1+u^{2n})(1+u^2)}du +2\int^\infty_1 \frac1{(1+u^{2n})(1+u^2)}du$$
By substitution $u\mapsto \frac1u$ on the second integral, one obtains 
$$2\int^1_0\frac{\frac1{u^2}du}{(1+1/u^{2n})(1+1/u^2)}=2\int^1_0\frac{u^{2n}}{(u^{2n}+1)(1+u^2)}du$$
Adding two integrals together, you see the cancellation and obtain
$$2\int^1_0\frac1{1+u^2}du=\frac{\pi}2$$
So, yes, your method does work for any $n$.
