Answer
$$\ln |x|-\frac{1}{2} \ln \left|x^{2}+1\right|+C$$
Work Step by Step
Given $$\int \frac{d x}{x\left(x^{2}+1\right)}$$
Since
\begin{align*}
\frac{1}{x\left(x^{2}+1\right)}&=\frac{A}{x}+\frac{Bx+C}{x^{2}+1}\\
&=\frac{A(x^{2}+1)+Bx}{x\left(x^{2}+1\right)}\\
1&=A(x^{2}+1)+Bx
\end{align*}
\begin{align*}
\text{at } x&=0 \ \ \ \ \to A=1 \\
\text{at } x&= 1\ \ \ \ \to B+C=-1\\
\text{at } x&= -1\ \ \ \ \to B-C=-1\\
\end{align*}
Hence $B=-1,\ \ \ C=0$ and
\begin{aligned}
\int \frac{1}{x\left(x^{2}+1\right)} d x &=\int \frac{1}{x} d x-\int \frac{\frac{1}{2} \cdot 2 x}{x^{2}+1} d x \\
&=\ln |x|-\frac{1}{2} \ln \left|x^{2}+1\right|+C
\end{aligned}