When converting a Riemann sum to an integral, how does one decide the bounds of the converted Riemann sum?

You can start with well known result that if a function $f:[a, b] \to\mathbb {R} $ is Riemann integrable on $[a, b] $ then $$\int_{a} ^{b} f(x) \, dx=\lim_{n\to\infty} \frac{b-a} {n} \sum_{r=1}^{n}f\left(a+r\cdot\frac{b-a}{n}\right)\tag{1}$$

The problem with your limit in question is that the summation index varies from $r=1$ to $r=2n$ instead of $r=1$ to $r=n$. This is the part which is easy to handle. Just replace $n$ by $2n$ in the formula $(1) $ and get the expression under limit in $(1)$ as $$\frac{b-a} {2n}\sum_{r=1}^{2n}f\left(a+r\cdot\frac{b-a}{2n}\right)\tag{2}$$ and try to compare the expression under limit in question with the above expression. You can always replace $n$ by any function of $n$ eg $n^2$ which is strictly increasing with $n$ and takes positive integer values and tends to $\infty $ and thereby deal with even weirder sums.

An easy guess is $(b-a) /2n=1/n$ so that $b-a=2$. Next rewrite the expression under summation as $$\frac{r/n}{\sqrt{1+(r/n)^2}}=\frac{r(b-a)/(2n)}{\sqrt{1+(r(b-a)/(2n))^2}}\tag{3}$$ and the last expression appears to be some function of $r(b-a) /(2n)$ (instead of a function of $a+r(b-a) /(2n)$). This gives another guess as $a=0$ and then $b=2$. The function $f$ in $(3)$ is easily guessed by replacing the $r(b-a)/(2n)$ with a single letter $x$ and we have $$f(x) =\frac{x} {\sqrt{1+x^2}}$$ and finally your limit is $$\int_{a} ^{b} f(x) \, dx=\int_{0}^{2}\frac{x}{\sqrt{1+x^2}}\,dx$$


And now a synthesis of the other two answers that involves less (apparent) guessing than one and slightly more precision than the other.

Suppose what you are given is a Riemann sum similar to the ones you performed by hand when introduced to the concept of Riemann sums (left Riemann sum, right Riemann sum, midpoint ...) Then you expect that you are looking at an expression of the form $$ \lim_{\text{the partition shrinks}} \Delta x \sum \text{sample heights} $$ So provisionally, we take $\Delta x = \frac{1}{n}$. (Provisionally, because our subsequent algebraic manipulations may result in modifying this term.)

The sum you are given uses $r$ as the index, so $r$ is which member of the partition we are sampling. We have $\Delta x = \frac{1}{n}$, so we expect the sample points to be (not necessarily exactly) $1/n$ apart, so sampled at $r$ steps of size $1/n$, which is $r/n$. So we want to algebraically manipulate the summand so that all occurrences of $r$ are of the form $r/n$. \begin{align*} \frac{r}{\sqrt{r^2 + n^2}} &= \frac{n \cdot r/n}{\sqrt{n^2 \cdot (r/n)^2 + n^2}} \\ &= \frac{n \cdot r/n}{\sqrt{n^2 \cdot \left( (r/n)^2 + n^2/n^2 \right)}} \\ &= \frac{n \cdot r/n}{n \sqrt{(r/n)^2 + 1 }} \\ &= \frac{r/n}{\sqrt{(r/n)^2 + 1 }} \text{.} \end{align*} (Technicality: in the denominator, we wrote $\sqrt{n^2} = n$. This isn't quite right. $\sqrt{n^2} = |n|$. However, we have $0 < n$, so $|n| = n$ here.)

Having succeeded, we know that the sample points of the function $\frac{x}{\sqrt{x^2+1}}$ occur at $x = r/n$. (There is a comment about horizontal translation and scaling below that may be of use to some readers at this point.) And these are separated by $1/n$, so $\Delta x = 1/n$ is promoted from provisionally correct to correct. If this were not the case, our job would be to find $p$ so that $\Delta x = 1/n^p$ appears in front of the sum and $r$ appears in the combination $r/n^p$ throughout. (This depends on the fact that the summand/integrand is an algebraic fraction, so such a $p$ can be found. If the integrand is more complicated, $\Delta x$ and the combination in which $r$ appears may be more complicated.)

But now we know the endpoints. Since $x$ is $r/n$, and $r$ ranges from $1$ to $2n$, we need to take the limits of the left-most $x$, $1/n$ and the right-most $x$, $2n/n$: \begin{align*} \lim_{n \rightarrow \infty} 1/n &= 0 \text{ and } \\ \lim_{n \rightarrow \infty} 2n/n &= 2 \text{.} \end{align*} From which, we know that an integral equivalent to our sum is $$ \int_0^2 \frac{x}{\sqrt{x^2 + 1}} \,\mathrm{d}x \text{.} $$

Why do I say "an"? Because there are many integrals equivalent to our sum. Here's another. $$ \int_7^9 \frac{u-7}{\sqrt{u^2 - 14u + 50}} \,\mathrm{d}u \text{,} $$ which is obtained by translating the previous integral to the right by $7$ units. That is, by the substitution $u = x+7$. We can make this integral be the one we land on by making $\frac{r}{n} + 7$ be the combination in which $r$ appears. \begin{align*} \frac{r}{\sqrt{r^2 + n^2}} &= \frac{n \cdot ((r/n+7) - 7)}{\sqrt{n^2 \cdot ((r/n+7) - 7)^2 + n^2}} \\ &= \frac{n \cdot ((r/n+7) - 7)}{\sqrt{n^2 \cdot \left( ((r/n+7) - 7)^2 + n^2/n^2 \right)}} \\ &= \frac{n \cdot ((r/n+7) - 7)}{n \cdot \sqrt{ ((r/n+7) - 7)^2 + 1}} \\ &= \frac{(r/n+7) - 7}{\sqrt{(r/n+7)^2 - 14(r/n+7) + 50}} \text{.} \end{align*} With $x = \frac{r}{n} + 7$, the integrand and limits of integration are $$ \frac{x-7}{\sqrt{x^2 - 14x + 50}} \text{,} $$ \begin{align*} \lim_{n \rightarrow \infty} \frac{1}{n} + 7 &= 7 \text{, and } \\ \lim_{n \rightarrow \infty} \frac{2n}{n} + 7 &= 9 \text{.} \end{align*}

We can even scale $x$ to $kr/n$ for $k \neq 0$. Similarly to the translation, we algebraically force the combination of $r$ to match. Unlike translation, our $\Delta x$ changes to $k/n$. (This should be unsurprising. When you make the substitution $u = kx$, you scale the variable in the integrand and scale the differential element.)

I mention translation and scaling to remove a common worry by students. There are many integrals corresponding to the sum you are given differing by scaling and translation. You only have to find one such integral. The integral that is easiest to find has $r$ appearing in a simple combination (no translation) and $\Delta x$ appearing without a constant multiplier (no scaling). You can always find the "simpler" integral (lacking translation or scaling) using the procedure we described first.


The upper limit of the integral can be simply written by answering the question:
"How many times of $n$ is the upper limit of the sum?"

The other substitutions would be $\dfrac1n \to \mathrm{d}x$ and $\dfrac rn \to x$

The answer to the question mentioned works to give you the right solution because of the substitution $\dfrac rn\to x$ . When $r=1, x=\dfrac 1n \text{ which} \to 0 \because n\to \infty. $ If the upper limit was $kn+c$ for some random sum, then for the upper lmit of the said integral to be calculated would still be $k$ , again because of the substitution for $x$. When $r=kn+c , x=\dfrac{kn+c}{n}=k+\dfrac cn=k \ \ (\because n\to \infty)$

This should help you find the upper/lower bounds for any sum that you would like to convert to an integral