How would we find the following limit? $$\lim _{n\to \infty }\sum _{i=1}^n\left(\frac{2\left(1+\frac{2i}{n}\right)}{\left(1+\frac{2i}{n}\right)^2+1}\right)\cdot \frac{2}{n}.$$
So I thought the equation of the function was $$y=\frac{2(1+2x)}{(1+2x)^2 + 1} × 2.$$
After simplifying it down, the entire function seem to get cancelled, leaving me with a limit of $0$, but this is incorrect. I think this is because the function I got was incorrect but I am not sure where I have gone wrong.
Any help?
 A: The point of this problem is to recognize it as a Riemann sum. Since we have $1 + 2i/n$ appearing in multiple places, it is natural to break the interval $[1, 3]$ into $n$ slices of uniform length $2/n$, and we have
$$\int_1^3 \frac{2x}{x^2 + 1} \, dx = \ln 5.$$
A: Since user296602 already gave the answer, let me show how we could get the partial sums.
$$\frac{2x}{x^2 + 1} =\frac{2x}{(x+i)(x-i)}=\frac{1}{x+i}+\frac{1}{x-i} $$ making
$$S_n=\frac 2n\sum _{i=1}^n\left(\frac{2\left(1+\frac{2i}{n}\right)}{\left(1+\frac{2i}{n}\right)^2+1}\right)=H_{\left(\frac{3}{2}-\frac{i}{2}\right)
   n}+H_{\left(\frac{3}{2}+\frac{i}{2}\right) n}-H_{\left(\frac{1}{2}-\frac{i}{2}\right) n}-H_{\left(\frac{1}{2}+\frac{i}{2}\right)
   n}$$ where appears generalized harmonic numbers.
Using the asymptotics
$$H_p=\gamma +\log \left({p}\right)+\frac{1}{2 p}-\frac{1}{12
   p^2}+O\left(\frac{1}{p^4}\right)$$ and simplifying
$$S_n=\log (5)-\frac{2}{5 n}-\frac{4}{75 n^2}+O\left(\frac{1}{n^4}\right)$$
which shows the limit and howw it is approached.
Forillustration purposes, let us compute $S_5$. The exact answer is $$S_5=\frac{530235046}{347146025}\approx 1.52741$$ while the above approximation leads to $$S_5\approx \log (5)-\frac{154}{1875}\approx 1.52730$$
