This seems confused to me.
You don't choose the $x_i$. The $x_i$ are all the rationals $p/q$ in lowest terms such that $1/q$ is greater than or equal to $\epsilon/2$. There only finitely many of these; namely: $ 1, {1\over2}, {1\over 3}, {2\over 3}, {1\over 4},{3\over 4},\ldots, {1\over N},\ldots,{N-1\over N} $ where $N$ is such that ${1\over N+1}<{\epsilon\over 2}$.
Two important (and perhaps redundant) observations:
- You have finitely many of these $x_i$, say $x_1,\ldots x_n$. Furthermore, these are the only places where $f$ has a "big" value.
You know that $f(x)$ is small, if $x\notin\{x_1,\ldots,x_n\}$. That is, if $x$ is not one of the $x_i$, then $f(x)<{\epsilon\over2}$.
The upper Riemann sum is split into two parts:
The first part takes advantage of 1. above, and represents the sum of the areas of rectangles whose bases have an $x_i$ in the center. You can take the length of the bases small enough to force the contribution to the total sum of this part to be small. In particular take each base to have length $\epsilon\over2 n$ (or perhaps smaller to prevent overlap).
This way, since by 1. there are $n$ rectangles for this part of the Riemann sum, the sum of the areas of the rectangles corresponding to the $x_i$ is at most $ \underbrace{n\vphantom{\epsilon\over 2n}}_{\text{ number of}\atop\text{rectangles} }\cdot \underbrace{1\vphantom{\epsilon\over 2n}}_{\text{over estimate}\atop\text{for height}} \cdot \underbrace{{\epsilon\over 2n}}_{\text{width}}={\epsilon\over 2} .$
The second part of the Riemann sum takes advantage of 2. above: the heights of the rectangles in the sum that are not centered at an $x_i$ is at most $ {\epsilon\over2}$; and, the sum of the areas of these rectangles will be less than, approximating crudely, $1\cdot {\epsilon\over 2}$.
This gives an upper Riemann sum that is less than ${\epsilon\over2}+{\epsilon\over2}=\epsilon$.