<s>[INST] Using right-hand Riemann sum to evaluate the limit of $ \frac{n}{n^2+1}+ \cdots+\frac{n}{n^2+n^2}$ I'm asked to prove that $$\lim_{n \to \infty}\left(\frac{n}{n^2+1}+\frac{n}{n^2+4}+\frac{n}{n^2+9}+\cdots+\frac{n}{n^2+n^2}\right)=\frac{\pi}{4}$$ This looks like it can be solved with Riemann sums, so I proceed:
\begin{align*}
\lim_{n \to \infty}\left(\frac{n}{n^2+1}+\frac{n}{n^2+4}+\frac{n}{n^2+9}+\cdots+\frac{n}{n^2+n^2}\right)&=\lim_{n \to \infty} \sum_{k=1}^{n}\frac{n}{n^2+k^2}\\
&=\lim_{n \to \infty} \sum_{k=1}^{n}(\frac{1}{n})(\frac{n^2}{n^2+k^2})\\
&=\lim_{n \to \infty} \sum_{k=1}^{n}(\frac{1}{n})(\frac{1}{1+(k/n)^2})\\
&=\lim_{n \to \infty} \sum_{k=1}^{n}f(\frac{k}{n})(\frac{k-(k-1)}{n})\\
&=\int_{0}^{1}\frac{1}{1+x^2}dx=\frac{\pi}{4}
\end{align*}
where $f(x)=\frac{1}{1+x^2}$. Is this correct, are there any steps where I am not clear? 
 [/INST] Notice, we have $$\lim_{n\to \infty}\left(\frac{n}{n^2+1}+\frac{n}{n^2+4}+\frac{n}{n^2+9}+\dots +\frac{n}{n^2+n^2}\right)=\lim_{n\to \infty}\sum_{r=1}^{n}\frac{n}{n^2+r^2}$$
$$\lim_{n\to \infty}\sum_{r=1}^{n}\frac{n}{n^2+r^2}=\lim_{n\to \infty}\sum_{r=1}^{n}\frac{\frac{1}{n}}{1+\left(\frac{r}{n}\right)^2}$$
Let, $\frac{r}{n}=x\implies \lim_{n\to \infty}\frac{1}{n}=dx\to 0$
$$\text{upper limit of x}=\lim_{n\to \infty }\frac{n}{n}=1$$
$$\text{lower limit of x}=\lim_{n\to \infty }\frac{1}{n}=0$$ Hence, using integration with proper limits, we get
$$\lim_{n\to \infty}\sum_{r=1}^{n}\frac{\frac{1}{n}}{1+\left(\frac{r}{n}\right)^2}= \int_ {0}^{1}\frac{dx}{1+x^2}$$ $$=\left[\tan^{-1}(x)\right]_{0}^{1}$$
$$=\left[\tan^{-1}(1)-\tan^{-1}(0)\right]$$ $$=\left[\frac{\pi}{4}-0\right]=\frac{\pi}{4}$$
</s>