Answer
$$\int \frac{5 x^{4}+7 x^{2}+x+2}{x\left(x^{2}+1\right)^{2}} d x=2 \ln \left(x \right)+\frac{3}{2} \ln \left(x^{2}+1\right) +\frac{1}{2} \tan ^{-1} x+\frac{x}{2\left(x^{2}+1\right)}+C$$
Work Step by Step
Given $$\int \frac{5 x^{4}+7 x^{2}+x+2}{x\left(x^{2}+1\right)^{2}} d x$$
Since
$ \frac{5 x^{4}+7 x^{2}+x+2}{x\left(x^{2}+1\right)^{2}} =\frac{A}{x}+\frac{B x+C}{x^{2}+1}+\frac{D x+E}{\left(x^{2}+1\right)^{2}}$
$ \frac{5 x^{4}+7 x^{2}+x+2}{x\left(x^{2}+1\right)^{2}}=\frac{A\left(x^{2}+1\right)+x(B x+C)\left(x^{2}+1\right)+x(D x+E)}{x\left(x^{2}+1\right)^{2}}$
So, we have
$$ 5 x^{4}+7 x^{2}+x+2 A\left(x^{2}+1\right)+x(B x+C)\left(x^{2}+1\right)+x(D x+E) $$
\begin{aligned}&5 x^{4}+7 x^{2}+x+2=A\left(x^{2}+1\right)^{2}+x(B x+C)\left(x^{2}+1\right)+x(D x+E) \\
&=A\left(x^{4}+2 x^{2}+1\right)+\left(B x^{2}+C x\right)\left(x^{2}+1\right)+D x^{2}+E x\\
& =A x^{4}+2 A x^{2}+A+B x^{4}+B x^{2}+C x^{3}+C x+D x^{2}+E x\\
& =\left(A x^{4}+B x^{4}\right)+C x^{3}+\left(2 A x^{2}+B x^{2}+D x^{2}\right)+(C x+E x)+ A\\
& =(A+B) x^{4}+(C) x^{3}+(2 A+B+D) x^{2}+(C+E) x+(A) \end{aligned}
by equating the coefficient of the same power, we get
\begin{aligned} 5 &=A+B \\ 0 &=C \\ 7 &=2 A+B+D \\ 1 &=C+E \\ 2 &=A \end{aligned}
this implies that
\begin{array}{l}{A=2} \\ {B=3} \\ {C=0} \\ {D=0} \\ {E=1}\end{array}
therefore
\begin{aligned} I&=\int \left(\frac{A}{x}+\frac{B x+C}{x^{2}+1}+\frac{D x+E}{\left(x^{2}+1\right)^{2}}\right)dx\\
&=\int \left(\frac{2}{x}+\frac{(3) x+0}{x^{2}+1}+\frac{(0) x+1}{\left(x^{2}+1\right)^{2}}\right)dx\\
&=\int \left(\frac{2}{x}+\frac{3 x}{x^{2}+1}+\frac{1}{\left(x^{2}+1\right)^{2}}\right) dx\\
&=2 \int \frac{1}{x} d x+3 \int \frac{x}{x^{2}+1} d x+\int \frac{1}{\left(x^{2}+1\right)^{2}} d x\\
&=2 \ln \left(x \right)+\frac{3}{2} \ln \left(x^{2}+1\right) +\int \frac{1}{\left(x^{2}+1\right)^{2}} d x\end{aligned}
Let $$I_1=+\int \frac{1}{\left(x^{2}+1\right)^{2}} d x$$
by considering
\begin{array}{l}{x=\tan \theta} \\ {d x=\sec ^{2} \theta d \theta} \\ {x=\tan \theta} \\ {\theta=\tan ^{-1} x}\end{array}
So, we get
\begin{array}{l}{I_1=\int \frac{1}{\left(\tan ^{2} \theta+1\right)^{2}} \cdot \sec ^{2} \theta d \theta} \\ {\ \ \ \ =\int \frac{\sec ^{2} \theta}{\left(\sec ^{2} \theta\right)^{2}} d \theta} \\ {\ \ \ \ =\int \frac{1}{\sec ^{2} \theta} d \theta} \\ {\ \ \ \ =\int \cos ^{2} \theta d \theta} \\ {\ \ \ \ =\int \frac{1}{2}(1+\cos 2 \theta) d \theta} \\ {\ \ \ \ =\frac{1}{2} \int 1+\cos 2 \theta d \theta} \\ {\ \ \ \ =\frac{1}{2}\left(\theta+\frac{1}{2} \sin 2 \theta+C\right)} \\ {\ \ \ \ =\frac{1}{2} \theta+\frac{1}{4} \sin 2 \theta+C}\\
{\ \ \ \ =\frac{1}{2} \theta+\frac{2}{4} \sin \theta \cos \theta+C} \\ {\ \ \ \ =\frac{1}{2} \theta+\frac{1}{2} \sin \theta \cos \theta+C} \\ {\ \ \ \ =\frac{1}{2} \tan ^{-1} x+\frac{1}{2} \cdot \frac{x}{\sqrt{x^{2}+1}} \cdot \frac{1}{\sqrt{x^{2}+1}}+C} \\ {\ \ \ \ =\frac{1}{2} \tan ^{-1} x+\frac{x}{2\left(x^{2}+1\right)}+C} \end{array}
So, we get
$$ I=2 \ln \left(x \right)+\frac{3}{2} \ln \left(x^{2}+1\right) +\frac{1}{2} \tan ^{-1} x+\frac{x}{2\left(x^{2}+1\right)}+C $$