Improper integral related proof Let $ f:[0,1)\to\mathbb{R} $ be an increasing nonnegative function such that $ \intop_{0}^{1}f\left(x\right)dx $ converges.
What I need to prove is that $ \lim_{n\to\infty}\left(\frac{1}{n}\sum_{k=0}^{n-2}f\left(\frac{k}{n}\right)\right)=\intop_{0}^{1}f\left(x\right)dx $.
And in order to do it, I should follow the guidance in the question.
These are the steps:
Step one:
I proved that for any $ 2\leq n\in\mathbb{N} $ it follows that
$ \frac{1}{n}\sum_{k=0}^{n-2}f\left(\frac{k}{n}\right)\leq\intop_{0}^{1}f\left(x\right)dx $
This wasn't hard. I fixed $ n\in \mathbb{N} $ and set a partition of the segment $ \left[0,\frac{n-1}{n}\right] $.
The expression in the left side is a lower Darboux sum, so it's smaller then the integral from $ 0 $ to $\frac{n-1}{n} $ and because $ f $ is nonnegative and increasing, it is also smaller than the integral.
Now, I'm stuck on the second step:
Fix $ 0<\delta<1 $.
Prove that $ \liminf\left(\frac{1}{n}\sum_{k=0}^{n-2}f\left(\frac{k}{n}\right)\right)\geq\intop_{0}^{1-\delta}f\left(x\right)dx $.
I'm not sure how to do it, any idea would be helpful.
The last step is simply to conclude that $ \lim_{n\to\infty}\left(\frac{1}{n}\sum_{k=0}^{n-2}f\left(\frac{k}{n}\right)\right)=\intop_{0}^{1}f\left(x\right)dx $
Thanks in advance.

We are given that $f$ is increasing and non-zero.  I also assume $f(0)$ is finite and the improper nature of the integral (if any) is due to behavior near $x = 1$. In the first part of the argument you are using
$$\int_0^{1-1/n} f(x) \, dx \leqslant \int_0^1 f(x) \, dx,$$
which is not necessarily true, since it is not given that $f$ is nonnegative. We could add a constant $C$ so that $C+f(x) > 0$ and proceed to prove that $C $ plus the limit of the sum equals $C$ plus the integral. However, there is a straightforward proof, as follows, which also handles the lower bound.
Since $f$ is increasing on $[0,1)$ we have
$$\frac{1}{n} f\left(\frac{k}{n} \right) \leqslant \int_{k/n}^{(k+1)/n} f(x) \, dx \leqslant \frac{1}{n}f\left(\frac{k+1}{n} \right)$$
Summing from $k = 0$ to $k = n-2$, we get
$$\frac{1}{n} \sum_{k=0}^{n-2}f\left(\frac{k}{n} \right) \leqslant \int_0^{1-1/n} f(x) \, dx \leqslant \frac{1}{n}\sum_{k=0}^{n-2}f\left(\frac{k+1}{n} \right) \\ = \frac{1}{n} \sum_{k=0}^{n-2}f\left(\frac{k}{n} \right) - \frac{1}{n}f(0) + \frac{1}{n}f(1-1/n)$$
Rearranging, we get
$$\int_0^{1-1/n} f(x) \, dx + \frac{1}{n}f(0) -  \frac{1}{n}f(1-1/n)\leqslant \frac{1}{n} \sum_{k=0}^{n-2}f\left(\frac{k}{n} \right) \leqslant \int_0^{1-1/n} f(x) \, dx $$
Clearly, $\underset{n \to \infty}\lim \frac{1}{n} f(0) = 0$, and since the integral over $[0,1)$ converges, we have
$$\lim_{n\to \infty} \int_0^{1-1/n} f(x) \, dx = \int_0^1 f(x) \, dx$$
If we can show that $\underset{n \to \infty}\lim \frac{1}{n} f(1- 1/n) = 0$, then by the squeeze theorem it follows that
$$\lim_{n \to \infty}\sum_{k=0}^{n-2}f\left(\frac{k}{n} \right) = \int_0^1 f(x) \, dx$$
Proof that $\underset{n \to \infty}\lim \frac{1}{n} f(1- 1/n) = 0$.
Since $f$ is increasing we have,
$$\tag{*}\frac{1}{2n} f(1- 1/n)\leqslant \int_{1 - 1/n}^{1- 1/(2n)} f(x) \, dx $$
Since the integral converges, it follows by the Cauchy criterion that for any $\epsilon > 0$ the RHS is smaller that $\epsilon/2$ for all sufficiently large $n$. This implies that $\frac{1}{n} f(1- 1/n)< \epsilon$ for all sufficiently large $n$ and $\underset{n \to \infty}\lim \frac{1}{n} f(1- 1/n) = 0$.
