<s>[INST] Help with this integral: $\int_{0}^{1}\frac{1}{1+x^{2}}dx$ (Riemann) I'm stuck when I try to solve this integral:
$$\int_{0}^{1}\frac{1}{1+x^{2}}dx$$
I try this:
$$\int_{0}^{1}\frac{1}{1+x^{2}}dx=\lim_{n\rightarrow\infty}\sum_{i=1}^{n}\frac{1}{1+(\frac{i}{n})^{2}}\frac{1}{n}=\lim_{n\rightarrow\infty}\frac{1}{n}\sum_{i=1}^{n}\frac{1}{1+(\frac{i}{n})^{2}}$$
Can someone help with the next step? I'm stuck.
 [/INST] We can proceed as follows.  First, we expand the term $\frac{n}{k^2+n^2}$ in the geometric series
$$\frac{n}{k^2+n^2}=\sum_{\ell =0}^N (-1)^\ell \frac{k^{2\ell}}{n^{2\ell +1}}+(-1)^{N+1}\frac{k^{2N+2}}{n^{2N+1}(k^2+n^2)}\tag 1$$
Then, summing $(1)$ reveals
$$\begin{align}
\sum_{k=1}^n \frac{n}{k^2+n^2}&=\sum_{k=1}^n\sum_{\ell =0}^N (-1)^\ell \frac{k^{2\ell}}{n^{2\ell +1}}+\frac{(-1)^{N+1}}{n^{2N+1}}\sum_{k=1}^n\frac{k^{2N+2}}{k^2+n^2}\\\\
&=\sum_{\ell =0}^N \frac{(-1)^\ell}{n^{2\ell +1}} \sum_{k=1}^n k^{2\ell}+\frac{(-1)^{N+1}}{n^{2N+1}}\sum_{k=1}^n\frac{k^{2N+2}}{k^2+n^2}\tag2
\end{align}$$
Note that we have the relationships 
$$\sum_{k=1}^n k^{2\ell}=\frac{n^{2\ell +1}}{2\ell +1}+O(n^{2\ell}) \tag3$$
and
$$\frac{n^{2N+1}}{2(2N+3)}\le \sum_{k=1}^n\frac{k^{2N+2}}{k^2+n^2}\le \frac{n^{2N+1}}{2N+3}\tag 4$$
Using $(3)$ and $(4)$ in $(2)$ and letting $N\to \infty$ yields
$$\sum_{k=1}^n \frac{n}{k^2+n^2}=\sum_{\ell =0}^\infty \frac{(-1)^\ell}{2\ell +1}+O\left(\frac1n\right)$$
whereupon letting $n\to \infty$ we obtain
$$\lim_{n\to \infty}\sum_{k=1}^n \frac{n}{k^2+n^2}=\sum_{\ell =0}^\infty \frac{(-1)^\ell}{2\ell +1}$$
Finally, recalling that the Taylor series for $\arctan(x)=\sum_{\ell=0}^\infty \frac{(-1)^\ell\,x^{2\ell +1}}{2\ell +1}$, we see that 
$$\lim_{n\to \infty}\sum_{k=1}^n \frac{n}{k^2+n^2}=\pi/4$$
as expected!
</s>