How to integrate $\int_0^{\infty}\frac{1}{(1+x)(1+x^2)}$ What is the method of integrating the following:
$$\int_0^{\infty}\frac{1}{(1+x)(1+x^2)}$$
I tried doing it via using partial fractions and deduce that:
$$\frac{\ln(x+1)}{2} - \frac{\ln(x^2+1)}{4} + \frac{\arctan(x)}{2} + C$$
However  I am unsure how to use the limits given in the question.
I suspect there is a way to do this using contour integration and this is probably the most straightforward method but I cannot see how to do it. Any help would be appreciated.

HINT:
Note that we have
$$\begin{align}
\frac12\log(x+1)-\frac14\log(x^2+1)&=\frac14 \log\left(\frac{x^2+2x+1}{x^2+1}\right)\\\\
&=\frac14 \log\left(1+\frac{2x}{x^2+1}\right)
\end{align}$$
And we have the estimates for $x>0$
$$0\le \log\left(1+\frac{2x}{x^2+1}\right)\le \frac{2x}{x^2+1}$$
Can you finish now?


ALTERNATIVE APPROACH:
Let $I$ be given by the integral $I=\int_0^\infty \frac{1}{(x+1)(x^2+1)}\,dx$.  We write the integral as the sum of integrals, the first from $0$ to $1$ and the second from $1$ to $\infty$.  The we enforce the substitution $x\mapsto 1/x$ in the second integral.  Proceeding we have
$$\begin{align}
I&=\int_0^1 \frac{1}{(x+1)(x^2+1)}\,dx+\color{blue}{\int_1^\infty \frac{1}{(x+1)(x^2+1)}\,dx}\\\\
&\overbrace{=}^{\color{blue}{x\mapsto 1/x}}\int_0^1 \frac{1}{(x+1)(x^2+1)}\,dx+\color{blue}{\int_1^0 \frac1{(1+1/x)(1+1/x^2)}\,\left(-\frac1{x^2}\right)\,dx}\\\\
&=\int_0^1 \frac{1}{(x+1)(x^2+1)}\,dx+\color{blue}{\int_0^1 \frac{x}{(x+1)(x^2+1)}\,dx}\\\\
&=\int_0^1 \frac1{1+x^2}\,dx\\\\
&=\frac\pi4
\end{align}$$
And we are done!
