Evalulate $\int_{-\infty}^{\infty}\frac{1}{(1+x^{2n})^2}dx$ by using residue theorem I know the answer of the integral $$\int_{-\infty}^{\infty}\frac{1}{1+x^{2n}}dx=\frac{\pi}{n\sin\left(\frac{\pi}{2n}\right)}$$where $n\in\mathbb{N}$.
But how to evalulate $$\int_{-\infty}^{\infty}\frac{1}{(1+x^{2n})^2}dx$$
where $n\in\mathbb{Z}$?
 A: First of all, write the integral (call it $J$) like this:
$$ J = \int_{-\infty}^{+\infty} \frac{1}{(1+x^{2n})^2} dx
= 2 \int_0^\infty \frac{1}{(1+x^{2n})^2} dx.$$ Denote the integral on the right by $I$.
The latter can be evaluated using a slice contour that consists of three parts: the segment $\Gamma_0$, which runs along the x axis from $0$ to some large $R$ then turns and appends the arc $$\Gamma_1: R e^{i t} \quad \text{where} \quad 0\le t \le \frac{\pi}{n}$$ and finally $\Gamma_2$, which runs straight from $R e^{\frac{i\pi}{n}}$ back to the origin to form a slice. Now the integral along $\Gamma_1$ is bounded by $R \frac{\pi}{n} \frac{1}{R^{4n}}$ and hence it disappears as $R$ goes to infinity because $\lim_{R\to\infty} \frac{1}{R^{4n-1}} = 0$. As for the integral along $\Gamma_2$, it can be parameterized setting $x = e^{\frac{i\pi}{n}} t$, giving $$ \int_R^0 \frac{1}{(1+e^{\frac{i\pi}{n}2n} t^{2n})^2} e^{\frac{i\pi}{n}} dt = -  e^{\frac{i\pi}{n}}\int_0^R \frac{1}{(1+e^{2i\pi} t^{2n})^2} dt =-  e^{\frac{i\pi}{n}}\int_0^R \frac{1}{(1+ t^{2n})^2} dt$$
Now apply the Cauchy Residue theorem to the closed contour $\Gamma_0 - \Gamma_1 - \Gamma_2.$ There is one pole inside the contour (a double pole at $x = e^{i\pi/2/n}$).
The residue is $$ \operatorname{Res}_{x=e^{i\pi/2/n}}\frac{1}{(1+x^{2n})^2} = - \frac{2n-1}{(2n)^2}e^{i\pi/2/n} $$ Putting it all together we obtain $$I \left(1 - e^{\frac{i\pi}{n}}\right) =
- 2\pi i \frac{2n-1}{(2n)^2}e^{i\pi/2/n}$$ or $$I = 2\pi i \frac{2n-1}{(2n)^2}
\frac{e^{i\pi/2/n}}{e^{i\pi/n} -1} = 2\pi i \frac{2n-1}{(2n)^2}
\frac{1}{e^{i\pi/2/n} - e^{-i\pi/2/n}} = \frac{2n-1}{(2n)^2} \frac{\pi}{\sin\left(\frac{\pi}{2n}\right)}.$$
It follows that the original integral is
$$J = \frac{2n-1}{2n^2} \frac{\pi}{\sin\left(\frac{\pi}{2n}\right)}.$$
Edit. As to the question about how we bound $\int_{\Gamma_1} f(x) dx$ where $f(x) = \frac{1}{(1+x^{2n})^2}$, this is done as follows:
$$ \left| \int_{\Gamma_1} f(x) dx \right| =
\left| \int_0^{\pi/n} \frac{1}{(1+R^{2n} e^{2nit})^2}  R i e^{it} dt\right| \le
\int_0^{\pi/n} \frac{R}{(R^{2n} -1)^2} dt =
\frac{\pi}{n} \frac{R}{(R^{2n} -1)^2}.$$
This term is $\theta(1/R^{4n-1})$ and disappears as claimed.
A: For $n<0$, denote $m=-n$. Then 
$$\int_{-\infty}^{\infty}\frac{1}{(1+x^{-2m})^2}dx=\int_{-\infty}^{\infty}\frac{x^{4m}}{(1+x^{2m})^2}dx$$
Which you can compute using the residue theorem, the same way you found the first integral.
A: close format for this type of integrals:
$$ \int_0^{\infty} x^{\alpha-1}Q(x)dx =\frac{\pi}{sin(\alpha \pi)} \sum_{i=1}^{n} Res_i((-z)^{\alpha-1}Q(z))$$
A: let$$I(a,n)=\int_{-\infty}^{\infty}\frac{1}{a^{2n}+x^{2n}}dx$$
$$I(a,n)=\int_{-\infty}^{\infty}\frac{1}{a^{2n}+x^{2n}}dx=\frac{1}{a^{2n}}\int_{-\infty}^{\infty}\frac{1}{1+(\frac{x}{a})^{2n}}dx$$
$$I(a,n)\stackrel{x=au}{=}\frac{1}{a^{2n-1}}\int_{-\infty}^{\infty}\frac{1}{1+(u)^{2n}}du=\frac{1}{a^{2n-1}}\frac{\pi}{n\sin(\frac{\pi}{2n})}$$
$$(I(1,n))'_a=-\int_{-\infty}^{\infty}\frac{2n}{(1+x^{2n})^2}dx=-\frac{2n-1}{n}\frac{\pi}{\sin(\frac{\pi}{2n})}$$
$$I=\int_{-\infty}^{\infty}\frac{1}{(1+x^{2n})^2}dx=\frac{2n-1}{2n^2}\frac{\pi}{\sin(\frac{\pi}{2n})}$$
