Calculate $\int_{-\infty}^\infty\frac{x^2}{1+x^8}dx$ I wanted to practice using the Residue theorem to calculate integrals. I chose an integral of the form $$\int_{-\infty}^\infty\frac{x^n}{1+x^m}dx$$and then choose random numbers for $n$ and $m$, which happened to be $$\int_{-\infty}^\infty\frac{x^2}{1+x^8}dx$$I know there is a general formula for integrals of this form, which is $$\int_{-\infty}^\infty\frac{x^n}{1+x^m}dx=\frac{\pi}{m}\csc\left(\frac{\pi(n+1)}{m}\right)$$But let's forget about this right now. I used the Residue theorem and the semicircular contour to get that $$\int_{-\infty}^\infty\frac{x^2}{1+x^8}dx=\Re\left(\frac{\pi i}{4}\left(\frac{1}{e^{\frac{5\pi i}{8}}}+\frac{1}{e^{\frac{15\pi i}{8}}}+\frac{1}{e^{\frac{25\pi i}{8}}}+\frac{1}{e^{\frac{35\pi i}{8}}}\right)\right)$$
Is there any other ways to calculate this integral?

Alternative complex solution:
$$\begin{align*}
I &= \int_{-\infty}^\infty \frac{x^2}{1+x^8} \, dx \\[1ex]
&= \int_0^\infty \frac{2x^2}{1+x^8} \, dx \tag{1} \\[1ex]
&= \int_0^\infty \frac{\sqrt x}{1+x^4} \, dx \tag{2} \\[1ex]
&= i \pi \sum_{k\in\{1,3,5,7\}} \operatorname{Res}\left(\frac{\sqrt z}{1+z^4}, z=e^{i\frac{k\pi}4}\right) \tag{3} \\[1ex]
&= \frac\pi{\sqrt2}\sin\left(\frac\pi8\right)
\end{align*}$$


*

*$(1)$ : symmetry

*$(2)$ : substitute $x\mapsto \sqrt x$

*$(3)$ : integrate in the complex plane along a deformed circular contour that avoids a branch cut taken along the positive real axis


We can also reduce the powers further to halve the number of residues one has to compute. For instance, with $x\mapsto \sqrt[4]{x}$ we get
$$I = \frac12 \int_0^\infty \frac{dx}{\sqrt[4]{x}(1+x^2)}$$
By the residue theorem (using the same contour and branch),
$$i2\pi \sum_{\zeta=\pm i} \operatorname{Res}\left(\frac1{\sqrt[4]{z}(1+z^2)}, z=\zeta\right) = (1+i) \int_0^\infty \frac{dx}{\sqrt[4]{x}(1+x^2)} \, dx \\
\implies 
I = \frac\pi2\left(\underbrace{\cos\left(\frac\pi8\right)-\sin\left(\frac\pi8\right)}_{=\sqrt2\sin\left(\frac\pi8\right)}\right)$$

Once more, under $x\mapsto \sqrt[8]{x}$,
$$I = \int_0^\infty \frac{2x^2}{1+x^8} \, dx = \frac14 \int_0^\infty \frac{dx}{x^{5/8}(1+x)}$$
and we can use the residue theorem again, or simply recognize the beta integral, so that $I=\frac14\operatorname{B}\left(\frac38,\frac58\right)$.
