why integration of $y=\frac{1}{1+x^2}$ is $\arctan(x)+c$? I manually integrated $$\int  \frac {dx}{x^2+1}$$
 using u substitution and I got $$\frac {\ln(1+x^2)}{2x}$$
 where did I go wrong?

u substitution
$x$ depends on $u$ hence you have to express $x$ as a function of $u$.

However, if $g=f^{-1}$ then
$$
g'(y)=\frac{1}{f'\left(g\left(y\right)\right)}
$$
With $f=\tan$ then
$$
\text{arctan}'\left(y\right)=\frac{1}{\tan'\left(\text{arctan}\left(y\right)\right)}
$$
Using that $\tan'\left(x\right)=1+\tan^2(x)$ we have
$$
\text{arctan}'\left(y\right)=\frac{1}{1+\tan\left(\text{arctan}\left(y\right)\right)}=\frac{1}{1+y^2}
$$
You can get the result indirectly through the chain rule, as follows:

Let y = arctanx. Then tany = x. Differentiate w/r to x: you get dy/dx = the square of cosy. But cosy = 1/[sq. root of(1+x-squared]) ....[To see this, draw a right triangle with legs 1 and x as the adjacent sides of angle y (to conform to the condition that tany=x)]. Thus we have dy/dx=1/(1+x-squared), i.e. 
d(arctanx)/dx=1/(1+x-squared), hence arctanx = the integral (antiderivative) of 
1/(1+x-squared).