Why does $\int_0^{n\pi}\frac{dx}{1+\tan^{2k}(x)}=n\frac\pi2$ hold for all non-negative integer $k$? I thought of putting $t=\tan x, x=\arctan t, dx=\frac{dt}{1+t^2}$ but then I erroneously get $$\int_{tan(0)}^{\tan(n\pi)}\frac{dt}{(1+t^2)(1+t^{2k})}$$which is $0$
I believe I should write the integral as $\int_0^\pi(\cdot)+\int_\pi^{2\pi}(\cdot)+\cdots+\int_{(n-1)\pi}^{n\pi}(\cdot)$ and then see that each one is $\pi/2$
 A: $$\int_0^{n\pi}\frac{dx}{1+\tan^{2k}x}$$
The integrand is periodic with period $\pi$ and symmetric within a period about $\pi/2$:
$$=2n\int_0^{\pi/2}\frac{dx}{1+\tan^{2k}x}$$
Swap the integral bounds. The integrand then evaluates to $\frac{\tan^{2k}}{1+\tan^{2k}x}$ by $\tan(\pi/2-x)=\cot x$. The sum of the two integrands is 1:
$$=\frac{2n}2\int_0^{\pi/2}1\,dx=\frac{n\pi}2$$
A: In $$I(n)=\int_{(n-1)\pi}^{n\pi}f(\tan x)dx,$$
put $y=x-(n-1)\pi,\implies dy=dx$
$$I(n)=\int_0^\pi f(\tan y)\ dy=I(1)$$
For integer $n\ge1,$
$$\implies\int_0^{n\pi}f(\tan x)\ dx=\sum_{r=0}^{n-1}\int_{r\pi}^{(r+1)\pi}f(\tan x)\ dx=n\int_0^{\pi}f(\tan x)\ dx$$
Now if $f(\tan x)=g(\tan^2x),$
$$\int_0^{\pi}f(\tan x)\ dx=\int_0^{\pi}g(\tan^2x)\ dx=\int_0^{\pi/2}g(\tan^2x)\ dx+\int_{\pi/2}^{\pi}g(\tan^2x)\ dx$$
Put $u=x-\pi$ in the last integral to find 
$$\int_0^{\pi}f(\tan x)\ dx=\int_0^{\pi/2}g(\tan^2x)\ dx+\int_{-\pi/2}^0g(\tan^2x)\ dx$$
Now use Evaluate the integral $\int^{\frac{\pi}{2}}_0 \frac{\sin^3x}{\sin^3x+\cos^3x}\,\mathrm dx$. for both integrals if
both the integrals are of the form $$\int_a^b\dfrac{u(x)}{u(x)+g(a+b-x)}\ dx$$
