$\left(1+x^{2}\right) \frac{d y}{d x}+2 x y=\frac{1}{1+x^{2}} ; y=0$ when $x=1$
$\left(1+x^{2}\right) \frac{d y}{d x}+2 x y=\frac{1}{1+x^{2}}$
$\Rightarrow \frac{d y}{d x}+\frac{2 x y}{1+x^{2}}=\frac{1}{\left(1+x^{2}\right)^{2}}$
This is a linear differential equation of the form:
$\frac{d y}{d x}+p y=Q$ (where $p=\frac{2 x}{1+x^{2}}$ and $Q=\frac{1}{\left(1+x^{2}\right)^{2}}$ )
Now, I.F $=e^{\int p d x}=e^{\int_{1+x^{2}}^{2 x d x}}=e^{\log \left(1+x^{2}\right)}=1+x^{2}$.
The general solution of the given differential equation is given by the relation,
$y(\mathrm{IF} .)=\int(\mathrm{Q} \times \mathrm{I} . \mathrm{F} .) d x+\mathrm{C}$
$\Rightarrow y\left(1+x^{2}\right)=\int\left[\frac{1}{\left(1+x^{2}\right)^{2}} \cdot\left(1+x^{2}\right)\right] d x+\mathrm{C}$
$\Rightarrow y\left(1+x^{2}\right)=\int \frac{1}{1+x^{2}} d x+\mathrm{C}$
$\Rightarrow y\left(1+x^{2}\right)=\tan ^{-1} x+\mathrm{C}$ ...(1)
Now, y = 0 at x = 1.
Therefore,
$0=\tan ^{-1} 1+\mathrm{C}$
$\Rightarrow \mathrm{C}=-\frac{\pi}{4}$
Substituting $C=-\frac{\pi}{4}$ in equation (1), we get:
$y\left(1+x^{2}\right)=\tan ^{-1} x-\frac{\pi}{4}$
This is the required general solution of the given differential equation.