Evaluating an improper integral $\int_{0}^{\infty}\frac{x^2}{(x^4+1)^2}dx$

Let us start with a step of integration by parts: $$ \int_{0}^{+\infty}\frac{1}{4x}\cdot\frac{4x^3}{(x^4+1)^2}\,dx =\int_{0}^{+\infty}\frac{1}{4x^2}\left(1-\frac{1}{1+x^4}\right)\,dx=\frac{1}{4}\int_{0}^{+\infty}\frac{dx}{x^2+\frac{1}{x^2}}$$ and finish with Glasser's master theorem: $$ \frac{1}{8}\int_{-\infty}^{+\infty}\frac{dx}{\left(x-\frac{1}{x}\right)^2+2}\stackrel{\text{GMT}}{=}\frac{1}{8}\int_{-\infty}^{+\infty}\frac{dx}{x^2+2} = \frac{\pi}{8\sqrt{2}}.$$


Consider the integral $$I(a,b)=\int_0^{\pi/2}\sin(x)^a\cos(x)^b\mathrm{d}x$$ Applying the substitution $t=\sin(x)^2$, we see that $$I(a,b)=\frac12\int_0^1t^{\frac{a-1}2}(1-t)^{\frac{b-1}2}\mathrm{d}t$$ $$I(a,b)=\frac12\int_0^1t^{\frac{a+1}2-1}(1-t)^{\frac{b+1}2-1}\mathrm{d}t$$ Recall the definition of the Beta function $$\mathrm B(x,y)=\int_0^1t^{x-1}(1-t)^{y-1}\mathrm{d}t=\frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}$$ Where $\Gamma(s)$ is the Gamma Function.

Hence we see that $$I(a,b)=\frac{\Gamma(\frac{a+1}2)\Gamma(\frac{b+1}2)}{2\Gamma(\frac{a+b}2+1)}$$ From $$\frac{\tan(x)^{1/2}}{\sec(x)^2}=\sin(x)^{1/2}\cos(x)^{3/2}$$ We see that your integral is $$I(1/2,3/2)=\frac{\Gamma(3/4)\Gamma(5/4)}{2\Gamma(2)}$$ $$I(1/2,3/2)=\frac{\Gamma(1/4)\Gamma(3/4)}{8}$$ And from $$\Gamma(s)\Gamma(1-s)=\frac\pi{\sin\pi s},\qquad s\not\in\Bbb Z$$ We have $$I(1/2,3/2)=\frac{\pi}{8\sqrt2}$$


Write $$\frac{x^2}{(1+x^4)^2} = \frac{4x^3}{(1+x^4)^2} \cdot \frac{1}{4x}.$$ Then integration by parts with the choice $$u = \frac{1}{4x}, \quad du = -\frac{1}{4x^2} \, dx, \\ dv = \frac{4x^3}{(1+x^4)^2} \, dx, \quad v = -\frac{1}{1+x^4},$$ yields $$I_1(x) = \int \frac{x^2}{(1+x^4)^2} \, dx = -\frac{1}{4x(1+x^4)} - \int \frac{1}{4x^2(1+x^4)} \, dx.$$ Now write $$\frac{1}{x^2(1+x^4)} = \frac{1}{x^2} - \frac{x^2}{1+x^4},$$ thus $$I_1(x) = -\frac{1}{4x(1+x^4)} + \frac{1}{4x} + \frac{1}{4} \int \frac{x^2}{1+x^4} \, dx = \frac{x^3}{4(1+x^4)} + \frac{1}{4} I_2(x),$$ where we now seek to evaluate $I_2(x)$. This is accomplished in a number of ways; one is to perform the factorization $$1+x^4 = (1 + \sqrt{2} x + x^2)(1 - \sqrt{2} x + x^2),$$ and compute the partial fraction decomposition $$\frac{x^2}{1+x^4} = \frac{1}{2\sqrt{2}} \left( \frac{x}{1 - \sqrt{2} x + x^2} - \frac{x}{1 + \sqrt{2} x + x^2} \right).$$ Then each term is integrable in closed form. This is not the easiest or most elegant approach, but it is perhaps the most elementary, requiring no knowledge beyond AP Calculus BC.