Prove $f\in\mathcal{R}$, when $f:[0,2]\to \Bbb{R}$, such that $f(x)=x$ when $x \neq 1$, and $f(x)=-1$, when $x=1$. So $f$ has a discontinuity at $1$.
Let $P$ be a partition of $[0,2]$, such that $P=\{0<\frac{1}{n}<\frac{2}{n}<\cdots\frac{n-2}{n}<1+\frac{1}{n}<1+\frac{2}{n}<\cdots2\}$.
With this partition, we consider only those subintervals, which lie to the left or right of $1$. This is because the subinterval $\Delta x_i$, which contains the discontinuity point, does not have a supremum $M_i$ corresponding to it. Rather, $M_i$ is arbitrarily close to $1$ and this is a big headache in terms of the proof.
Here is the actual proof. Let $P$ be such as above. Then $$U(P,f)-L(P,f)=\sum_{i=1}^n\Delta x_iM_i-\sum_{i=1}^n\Delta x_im_i=\frac{1}{n}\Biggr(\sum_{i=1}^nM_i-m_i\Biggr)$$
and in this case $\sum_{i=1}^nM_i-m_i=2-(-1)=3$. Is this correct?
You chose a partition $P$ with points
$$\underbrace{0,\,\frac{1}{n},\,\frac{2}{n},\,\cdots,\frac{n-2}{n}}_{x_0,x_1,\ldots, x_{n-2}},\,\underbrace{1+\frac{1}{n},\,1+\frac{2}{n},\,\cdots,\,2}_{x_{n-1}, x_{n-2},\ldots,x_{2n-1}}$$
In this case,
$$U(P,f) - L(P,f) = \sum_{j=1}^{2n-1}(M_j - m_j) (x_j - x_{j-1}) \\ =\frac{1}{n}\sum_{j=1}^{n-2}\left(\frac{j}{n} - \frac{j-1}{n}\right) + \frac{3}{n}\left(1 + \frac{1}{n} -(-1) \right)+ \frac{1}{n}\sum_{j=2}^{n}\left(1+\frac{j}{n} - \left(1+\frac{j-1}{n}\right)\right)\\ = \frac{n-2}{n^2} + 3\frac{2+ 1/n}{n} + \frac{n-1}{n^2} = \frac{8}{n}, $$
which tends to $0$ as $n$ tends to $\infty$.
Hence, for any $\epsilon > 0$ we can find a partition such that the difference between the upper and lower sums is less than $\epsilon$, proving that $f$ is integrable by the Riemann criterion.