Integrate $\int \frac{(1-x)^2 \cdot e^x}{(1+x^2)^2}dx$ Integrate using integrating by parts : 

$$\int \frac{(1-x)^2 \cdot e^x}{(1+x^2)^2}dx$$

My attempt  :
$$I=\int \frac{(1-x)^2 \cdot e^x}{(1+x^2)^2}dx$$
$$I=\int \frac{e^x}{(1+x^2)^2}\cdot(1-x)^2dx$$
$$I=\frac{e^x}{(1+x^2)^2}\cdot\frac{(1-x)^3}{-3}-\int \frac{(1-x)^3}{-3}\cdot\frac{(1+x^2)^2e^x-e^x\cdot2(1+x^2)\cdot2x}{(1+x^2)^4}dx$$
Now it is little bit confusing. How can I simplify this ? Is there another method to do it differently ?
 A: Hint
$$\frac{(1-x)^2 \cdot e^x}{(1+x^2)^2}=\frac{e^x}{1+x^2}-\frac{2xe^x}{(1+x^2)^2}$$
Indeed
$$(1-x)^2=(1+x^2)-2x$$
A: $$\int  \frac { (1-x)^{ 2 }\cdot e^{ x } }{ (1+x^{ 2 })^{ 2 } } dx=\int { \frac { { e }^{ x } }{ (1+x^{ 2 }) } dx-2\int { \frac { x{ e }^{ x } }{ (1+x^{ 2 })^{ 2 } } dx= }  } \\ =\int { \frac { d{ e }^{ x } }{ 1+x^{ 2 } }  } -2\int { \frac { x{ e }^{ x } }{ (1+x^{ 2 })^{ 2 } } dx= } \left( \frac { { e }^{ x } }{ 1+x^{ 2 } } +2\int { \frac { { xe }^{ x } }{ { \left( 1+x^{ 2 } \right)  }^{ 2 } } dx }  \right) -\\-2\int { \frac { x{ e }^{ x } }{ (1+x^{ 2 })^{ 2 } } dx=\frac { { e }^{ x } }{ 1+x^{ 2 } } +C } $$
A: Just if you look for another way to do it.
Because of the square in denominator and the exponential in numerator, you could have assumed that the result is 
$$\int \frac{(1-x)^2 }{(1+x^2)^2}e^x\,dx= \frac {P_n(x)}{1+x^2}e^x$$ where $P_n(x)$ is a polynomial of degree $n$.
Differentiate both sides 
$$\frac{(1-x)^2 }{(1+x^2)^2}e^x=\frac{ \left(x^2+1\right) P'_n(x)+(1-x)^2 P_n(x)}{\left(1+x^2\right)^2}e^x$$ that is to say $$(1-x)^2=\left(x^2+1\right) P'_n(x)+(1-x)^2 P_n(x)$$ Comparing the degrees : $2$ for the lhs and $n+2$ in the rhs makes $n=0$; so $P_n(x)$ is just a constant. This implies that $P'_n(x)=0$ and what is left is $$(1-x)^2=(1-x)^2 P_0(x)$$ which makes $P_0(x)=1$.
