Speed of convergence of Riemann sums This question is inspired by a previous question. It was shown that, for all function $f \in \mathcal{C} ([0, 1])$, 
$$ \lim_{n \to + \infty} \sum_{k=0}^{n} f \left( \frac{k}{n+1} \right) - \sum_{k=0}^{n-1} f \left( \frac{k}{n} \right) = \int_0^1 f (x) \ dx.$$
A stronger statement would be that there exists some constant $a(f)$ such that:
$$\sum_{k=0}^{n-1} f \left( \frac{k}{n} \right) = n \int_0^1 f (x) \ dx + a(f) + o(1),$$
or, in other words, that there is an asymptotic development at order $1$ of the Riemann sums:
$$\frac{1}{n} \sum_{k=0}^{n-1} f \left( \frac{k}{n} \right) = \int_0^1 f (x) \ dx + \frac{a(f)}{n} + o(n^{-1}).$$
Given $f$, can we always find such a constant $a(f)$? If this is false, can we find a counter-example? If this is true, can $a(f)$ be written explicitely?
I have had a quick look at the litterature, but most asymptotics for the Riemann sums involve different meshes, which depend on the function $f$.
 A: On the subspace $\mathcal{C}^1([0,1])$ of continuously differentiable functions, we have
$$\lim_{n\to\infty} \sum_{k=0}^{n-1} f\left(\frac{k}{n}\right) - n\int_0^1 f(x)\,dx = \frac{f(0) - f(1)}{2}.$$
We can see that by computing
$$\begin{align}
&\Biggl\lvert\frac12\left(f\left(\frac{k}{n}\right) + f\left(\frac{k+1}{n}\right)\right) - n\int_{k/n}^{(k+1)/n} f(x)\,dx\Biggr\rvert\\
&\qquad = \frac{n}{2}\left\lvert \int_{k/n}^{(k+1)/n} \left(f\left(\frac{k+1}{n}\right)-f(x)\right) - \left(f(x) - f\left(\frac{k}{n}\right)\right)\,dx\right\rvert\\
&\qquad = \frac{n}{2}\left\lvert\int_{k/n}^{(k+1)/n}\int_x^{(k+1)/n} f'(t)\,dt - \int_{k/n}^x f'(t)\,dt\,dx\right\rvert\\
&\qquad = \frac{n}{2}\left\lvert\int_{k/n}^{(k+1)/n}\left(t-\frac{k}{n}\right)f'(t) - \left(\frac{k+1}{n}-t\right)f'(t)\,dt\right\rvert\\
&\qquad = n\left\lvert\int_{k/n}^{(k+1)/n} \left(t-\frac{k+\frac12}{n}\right)f'(t)\,dt\right\rvert\\
&\qquad = n\left\lvert\int_{k/n}^{(k+1)/n} \left(t-\frac{k+\frac12}{n}\right)\left(f'(t)- f'\left(\frac{k+\frac12}{n}\right)\right)\,dt\right\rvert\\
&\qquad \leqslant n \cdot\omega_{f'}\left(\frac{1}{2n}\right) \int_{k/n}^{(k+1)/n} \left\lvert t-\frac{k+\frac12}{n}\right\rvert\,dt\\
&\qquad = \frac{1}{4n}\cdot\omega_{f'}\left(\frac{1}{2n}\right),
\end{align}$$
where
$$\omega_{f'}(\delta) = \sup \left\lbrace \lvert f'(s) - f'(t)\rvert : s,t\in [0,1], \lvert s-t\rvert \leqslant \delta\right\rbrace$$
is a modulus of continuity of $f'$. Summing up we obtain
$$\left\lvert \sum_{k=0}^{n-1} f\left(\frac{k}{n}\right) - \frac{f(0)-f(1)}{2} - n\int_0^1 f(x)\,dx\right\rvert \leqslant \frac14 \cdot\omega_{f'}\left(\frac{1}{2n}\right),$$
and the continuity of $f'$ means $\lim\limits_{\delta\searrow 0} \omega_{f'}(\delta) = 0$.
But there is no map $\alpha \colon \mathcal{C}([0,1]) \to \mathbb{C}$ such that for every $f \in \mathcal{C}([0,1])$ we have
$$\lim_{n\to\infty} \sum_{k=0}^{n-1} f\left(\frac{k}{n}\right) - n\int_0^1 f(x)\,dx = \alpha(f),$$
or equivalently
$$\frac{1}{n}\sum_{k=0}^{n-1} f\left(\frac{k}{n}\right) = \int_0^1 f(x)\,dx + \frac{\alpha(f)}{n} + o\left(\frac1n\right).$$
For if there were, since $\mathcal{C}([0,1])$ is a Banach space under the supremum norm, the Banach-Steinhaus theorem (uniform boundedness principle) would assert that the family
$$T_n \colon f \mapsto \sum_{k=0}^{n-1} f\left(\frac{k}{n}\right) - n\int_0^1 f(x)\,dx$$
is equicontinuous, or norm-bounded.
However, it is easy to see that
$$\lVert T_n\rVert = 2n.$$
Thus the set of $f \in \mathcal{C}([0,1])$ such that
$$\lim_{n\to\infty} \sum_{k=0}^{n-1} f\left(\frac{k}{n}\right) - n\int_0^1 f(x)\,dx$$
exists is meagre (it is, however, strictly larger than $\mathcal{C}^1([0,1])$).
Note that the previous question only considered continuously differentiable functions, i.e. $\mathcal{C}^1([0,1])$. The Banach-Steinhaus theorem shows that
$$\lim_{n\to\infty} \sum_{k=0}^n f\left(\frac{k}{n+1}\right) - \underbrace{\sum_{k=0}^{n-1} f\left(\frac{k}{n}\right)}_{S_n(f)}$$
does not exist for all $f\in\mathcal{C}([0,1])$, since $\lVert S_{n+1} - S_n\rVert = 2n-1$ is not bounded.
