<s>[INST] Dividing a polynomial with $(x^2+1)^2$ I have been given that a polynomial $f(x)$ with real coefficients is divisible by $(x^2+1)$, and that when $f'(x)$ is divided by $(x^2+1)$, we get a remainder of $(x+1)$. I need to prove that $2f(x)+(x-1)(x^2+1)$ is divisible by $(x^2+1)^2$. 
What I did was to express $f(x)$ as $f(x)=(x^2+1)g(x)$, for some polynomial $g$ (1),and $f'(x)=((x^2+1))q(x) + (x+1)$, for some polynomial $q$ (2).
From (1) I deduced another expression of $f'(x)$, (3): $$f'(x)=(x^2+1)g'(x) + 2x(g(x))$$ 
I then expressed the given expression as:
$$2f(x)+(x-1)(x^2+1) = 2(x^2+1)g(x) + (x-1)(x^2+1)$$ (4)
To find an expression for $g(x)$, I then equated (2) and (3) above, to get 
$$ 2g(x) = (x^2+1)(q(x)-g'(x) + x+1)(1/x)$$
Letting $(q(x)-g'(x) + x+1)(1/x) = h(x)$, I simplified to:
$$2g(x)= (x^2+1)h(x)$$
then here I stopped, realizing that $h(x)$ is maybe not even a polynomial. 
Any alternative method or advancement of this one will be very appreciated!
 [/INST] Mark's answer is nicer than this, but it is possible to continue along the lines you started:
Since $f'(x)=(x^2+1)g'(x)+2x g(x)$, $2x g(x)$ has the same remainder $(x+1)$ when divided by $x^2+1$ as does $f'(x)$. That is,
$$
2xg(x)=h(x)(x^2+1)+x+1
$$
for some polynomial $h$. By setting $x=0$, we can see that $h(0)=-1$; thus $h(x)=xk(x)-1$ for some other polynomial $k$. So
\begin{align}
2xg(x)&=(xk(x)-1)(x^2+1)+x+1\\
&=xk(x)(x^2+1)-x^2+x
\end{align}
Dividing by $x$ gives
$$
2g(x)=k(x)-(x-1)
$$
which upon multiplying by $(x^2+1)$ yields the desired relation.
</s>