How do I determine A polynomial "P" that has a degree equal or inferior to $3$ that has these properties $1$ is a root of degree 2 and has a remainder of $6X+2$ when divided by $X^2+1$.
I tried writing it as $$P(X)=(X-1)^2(aX+b) + R(X)$$ and $$P(X)=(X^2+1)(cX+d) + 6X+2$$
and couldn't find a solution.

It is $R(X)=0$. In second case it is $cX+d$ and not $aX+b$ .
Then write $P(X) = P(X)$:

 $$(X-1)^2(aX+b) =(X^2+1)(cX+d) + 6X+2$$
 and do the comparing of coefficents.

