If $f:[0,1]\to \mathbb R$ is a differentiable function with continuous derivative then I can show that
$$ \lim_{n \to \infty} \left[ \sum_{k=1}^n f\!\left(\dfrac kn \right) - n \int_0^1 f(x)\,dx \right] = \frac{f(1)-f(0)}2. $$
My question is: does this fact remain true if we only assume that $f$ is differentiable (on $[0,1]$)? Or just that the derivative of $f$ is bounded on $[0,1]$ and Riemann integrable?
(I know that just the continuity of $f$ does not lead to the identity.)
We will use the following result:
If $~g:[0,1]\to\mathbb{R}~$ has a Riemann integrable derivative. 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, having a Riemann integrable derivative implies that $g$ is a Lipschitz function, so it is absolutely continuous, and the formula of integration by parts, which is valid in this case, shows that: \begin{align*} \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\\ &=\frac{g(1)+g(0)}{2}-\int_0^1g(x)dx \end{align*}
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 equalities we obtain $$ \sum_{k=0}^n f\left(\frac{k}{n}\right)-\frac{f(1)+f(0)}{2}-n\int_0^1f(x)dx= \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 Riemann integrable function $f'$, hence $$ \forall\,x\in[0,1],\quad\lim_{n\to\infty}H_n(x)=\int_0^1f'(t)dt $$ Moreover, $\vert{H_n(x)}\vert\leq\sup_{[0,1]}\vert{f'}\vert$. So, taking the limit as $n$ tends to $+\infty$, and applying the Dominated Convergence Theorem, we obtain $$\lim_{n\to\infty}\left( \sum_{k=0}^nf\left(\frac{k}{n}\right)-\frac{f(1)+f(0)}{2}-n\int_0^1f(x)dx\right)= \left(\int_0^1f'(t)dt\right)\int_0^1\left(x-\frac{1}{2}\right)dx=0. $$ which is the desired conclusion.