Step 1. Let $y(x) = \frac{1}{w(x)}$. Then $y^\prime(x) = -\frac{1}{w(x)^2}\cdot w^\prime(x)$, so the differential equation becomes $ \frac{(1+x)^2 w^\prime(x) + x w(x) + x^2}{w(x)^2} = 0$, that is $ w^\prime(x) + \frac{x}{(1+x)^2} w(x) + \frac{x^2}{(1+x)^2}=0$.
Step 2. Integrating factor, let $w(x) = f(x) g(x)$, and we will seek $f(x)$ so as to get rid of the term $x w(x)$. Substituting, $f^\prime(x) g(x) + f(x) g^\prime(x) + \frac{x}{(1+x)^2}f(x) g(x) + \frac{x^2}{(1+x)^2} = 0$. Choosing $f(x)$ such that $f^\prime(x) + \frac{x}{(1+x)^2} f(x) = 0$, the equation becomes $ g^\prime(x) = -\frac{1}{f(x)} \frac{x^2}{(1+x)^2}$, which is readily solvable for a known $f(x)$.
Step 3. Solve the auxiliary equation $f^\prime(x) = -\frac{x}{(1+x)^2} f(x)$. For this, rewrite it as $\left( \log( f(x) )\right)^\prime = - \frac{x}{(1+x)^2}$, and integrate both sides, giving $\log(f(x)) = \int \frac{x}{(1+x)^2} \mathrm{d} x + C = \log(1+x) - \frac{x}{1+x} + \log f_0$. That is $f(x) = f_0 (1+x) \exp\left( - \frac{x}{1+x} \right)$.
Step 4. Solve the ODE for $g(x)$ by direct integration: $\begin{eqnarray} g(x) &=& -\int \frac{1}{f(x)} \frac{x^2}{(1+x)^2} \mathrm{d} x + C = - \int \frac{1}{f_0} \exp\left( \frac{x}{1+x} \right) \frac{x^2}{(1+x)^3} \mathrm{d} x + C \\ &\stackrel{x=-\frac{t+1}{t}}{=}& \frac{\mathrm{e}}{f_0} \int \mathrm{e}^{t} \frac{t^2+2 t + 1}{t} \mathrm{d} t + C = \frac{\mathrm{e}}{f_0} \mathrm{e}^t (1+t) + \frac{\mathrm{e}}{f_0} \int \frac{\mathrm{e}^t}{t} \mathrm{d} t + C \end{eqnarray} $ The remaining integral is not elementary, let's denote it by $F(t) = \int \mathrm{e}^t \frac{\mathrm{d} t}{t}$.
Step 5. Find $y(x) = \frac{1}{w(x)} = \frac{1}{f(x) g(x)}$. $ y(x) = \frac{\mathrm{e}^{\frac{x}{1+x}}}{(1+x)\left( \exp\left(\frac{x}{1+x} \right) \frac{x}{1+x} + F\left(-\frac{1}{1+x}\right) + C\right)} = \frac{1}{x + (1+x) \exp\left( - \frac{x}{1+x} \right) \left( F\left( -\frac{1}{1+x} \right) + C \right) } $
Step 6. Check your equation. Are you sure the original equation is correct ? Should you have $(1+x^2) y^\prime(x)$, instead of $(1+x)^2 y^\prime(x)$, the solution would come out elementary.