Answer
\[I=\frac{1}{4}\ln |x|-\frac{1}{8}\ln |x^2+4|+\tan^{-1}\frac{x}{2}+C\]
Where $C$ is constant of integration
Work Step by Step
Let \[I=\int \frac{2x+1}{x(x^2+4)}dx\]
We first determine the partial fraction decomposition of the integrand
\[\frac{2x+1}{x(x^2+4)}=\frac{A}{x}+\frac{Bx+C}{x^2+4}\;\;\;...(*)\]
\[2x+1=A(x^2+4)+Bx^2+Cx\]
\[2x+1=(A+B)x^2+Cx+4A\]
Comparing like coefficients both side
\[A+B=0\Rightarrow B=-A\;\;\;...(1)\]
\[C=2\]
\[4A=1\Rightarrow A=\frac{1}{4}\]
From (1)
\[B=\frac{-1}{4}\]
From (*)
\[\frac{2x+1}{x(x^2+4)}=\frac{1}{4x}+\frac{\frac{-1}{4}x+2}{x^2+4}\]
\[\Rightarrow I=\int\left[\frac{1}{4x}+\frac{\frac{-1}{4}x+2}{x^2+4}\right]dx\]
\[I=\frac{1}{4}\int\frac{1}{x}dx-\frac{1}{4}\int\frac{x}{x^2+4}dx+2\int\frac{1}{x^2+(2)^2}dx\]
\[I=\frac{1}{4}\int\frac{1}{x}dx-\frac{1}{8}\int\frac{2x}{x^2+4}dx+2\int\frac{1}{x^2+(2)^2}dx\;\;\;...(2)\]
Let \[I_1=\frac{1}{4}\int\frac{1}{x}dx\]
\[I_1=\frac{1}{4}\ln |x|\;\;\;...(3)\]
Let \[I_2=-\frac{1}{8}\int\frac{2x}{x^2+4}dx\]
Let $t=x^2+4$____(**)
$\Rightarrow dt=2xdx$
\[I_2=-\frac{1}{8}\int\frac{1}{t}dt\]
\[I_2=-\frac{1}{8}\ln |t|\]
From (**)
\[I_2=-\frac{1}{8}\ln |x^2+4|\;\;\;...(4)\]
Let \[I_3=2\int\frac{1}{x^2+(2)^2}dx\]
We will use the formula
\[
\int\frac{1}{x^2+(a)^2}dx=\frac{1}{a}\tan^{-1}\frac{x}{a}\;\;\;...(***)\]
Using (***)
\[I_3=\frac{2}{2}\tan^{-1}\frac{x}{2}\]
\[I_3=\tan^{-1}\frac{x}{2}\;\;\;...(5)\]
Using (3),(4) and (5) in (1)
\[I=\frac{1}{4}\ln |x|-\frac{1}{8}\ln |x^2+4|+\tan^{-1}\frac{x}{2}+C\]
Where $C$ is constant of integration
Hence,
\[I=\frac{1}{4}\ln |x|-\frac{1}{8}\ln |x^2+4|+\tan^{-1}\frac{x}{2}+C.\]