<s>[INST] Integrate $\int \frac{(x+1)}{(x^2+2)^2}dx$ This is the question I want to ask
Integrate $$\int \frac{(x+1)}{(x^2+2)^2}\,dx.$$
 I tried it using algebric manipulation
Integrate $x/(x^2+2)^2+1/(x^2+2)^2$.
Then the latter part would not be solved.
 [/INST] We split the integral into two components as
$$\int\frac{x+1}{(x^2+2)^2}dx=\int\frac{x}{(x^2+2)^2}dx+\int\frac{1}{(x^2+2)^2}dx\tag 1$$

The first integral on the right-hand side of $(1)$ is trivial to evaluate using the substitution $x^2=u\implies x\,dx\to \frac12 du$.  Then, 
$$\begin{align}
\int\frac{x}{(x^2+2)^2}dx&=\frac12\int  \frac{1}{(u+2)^2}\,du\\\\
&=-\frac12 \frac{1}{u+2}\\\\
&=-\frac12 \frac{1}{x^2+2} \tag 2
\end{align}$$

For the second integral on the right-hand side of $(1)$ , we use the classical trigonometric substitution $x=\sqrt{2}\tan \theta\implies dx=\sqrt{2}\sec^2 \theta d\theta$.  Then,
$$\begin{align}
\int\frac{1}{(x^2+2)^2}dx&=\frac{\sqrt{2}}{4}\int  \frac{\sec^2 \theta}{\sec^4 \theta}\,d\theta\\\\
&=\frac{\sqrt{2}}{4}\int  \cos^2 \theta \,d\theta\\\\
&=\frac{\sqrt{2}}{4}\int  \left(\frac{1+\cos 2x}{2}\right) \,d\theta\\\\
&=\frac{\sqrt{2}}{8} \left(\theta +\frac12 \sin 2\theta\right)\\\\
&=\frac{\sqrt{2}}{8} \left(\theta + \sin \theta \cos \theta \right)\\\\
&=\frac{\sqrt{2}}{8} \left(\arctan(x/\sqrt{2}) + \frac{\sqrt{2}x}{x^2+2} \right) \tag 3\\\\
\end{align}$$

Putting $(2)$ and $(3)$ together, we have
$$\bbox[5px,border:2px solid #C0A000]{\int\frac{x+1}{(x^2+2)^2}dx=\frac{\sqrt{2}}{8} \arctan(x/\sqrt{2})+\frac14 \frac{x-2}{x^2+2}+C}$$
</s>