I've been trying to solve this problem, but I haven't been able to calculate the exact limit, I've just been able to find some boundaries. I hope you guys can help me with it.
Let $f:[0,1] \to \mathbb{R}$ a differentiable function with a continuous derivative, calculate: $$\lim_{n\to \infty}\left(\sum_{k=1}^nf\left(\frac{k}{n}\right)-n\int_0^1f(x)dx\right) $$ I tried using Mean Value Theorem for derivatives and integrals and I got that $$\lim_{n\to \infty}\left(\sum_{k=1}^nf\left(\frac{k}{n}\right)-n\int_0^1f(x)dx\right)=\lim_{n\to \infty}\left(\sum_{k=1}^nf'\left(x_k**\right)(\frac{k}{n}-x_k*)\right) $$ Where $x_k*\in [\frac{k-1}{n},\frac{k}{n}]$ and $x_k**\in [x_k*,\frac{k}{n}]$, which looks like a Riemann Sum but I'm not sure if it's a Riemann Sum of $f'$ from $0$ to $1$, if this was true I believe the limit is $f(1)-f(0)$ but I'm not really sure about this.
Edit: fixed some typos with the $\frac{k}{n}$.
Edit 2: $k$ starts from $1$ not $0$.

Let $$ x_n=\sum_{k=0}^nf\left(\frac{k}{n}\right)-n\int_0^1f(x)dx $$
We will use the following result:
Lemma If $g:[0,1]\to\mathbb{R}$ is a continuously differentiable function. Then $$ \frac{g(0)+g(1)}{2}-\int_0^1g(x)dx= \int_{0}^1\left(x-\frac{1}{2}\right)g'(x)dx. $$ Indeed, this is just integration by parts: $$\eqalign{ \int_{0}^1\left(x-\frac{1}{2}\right)g'(x)dx &=\left.\left(x-\frac{1}{2}\right)g(x)\right]_{x=0}^{x=1} -\int_0^1g(x)dx\cr &=\frac{g(1)+g(0)}{2}-\int_0^1g(x)dx }$$
Now applying this to the functions $x\mapsto f\left(\frac{k+x}{n}\right)$ for $k=0,1,\ldots,n-1$ and adding the resulting inequalities we obtain $$ x_n-\frac{f(0) +f(1)}{2} = \int_0^1\left(x-\frac{1}{2}\right)H_n(x)dx\tag{1} $$ where, $$ H_n(x)=\frac{1}{n}\sum_{k=0}^{n-1}f'\left(\frac{k+x}{n}\right) $$ Clearly for every $x$, $H_n(x)$ is a Riemann sum of the function continuous $f'$, hence $$ \forall\,x\in[0,1],\quad\lim_{n\to\infty}H_n(x)=\int_0^1f'(t)dt $$ Moreover, $| H_n(x)|\leq\sup_{[0,1]}|f'|$. So, taking the limit in $(1)$ and applying the Dominated Convergence Theorem, we obtain $$ \lim_{n\to\infty}\left(x_n-\frac{f(0) +f(1)}{2}\right)= \left(\int_0^1f'(t)dt\right)\int_0^1\left(x-\frac{1}{2}\right)dx=0. $$ This proves that $$ \lim_{n\to\infty}x_n=\frac{f(0) +f(1)}{2} $$
And consequently $$ \lim_{n\to\infty}\left(\sum_{k=\color{red}{1}}^nf\left(\frac{k}{n}\right)-n\int_0^1f(x)dx\right)=\frac{f(1)-f(0)}{2} $$