The following identity attributed to N.Y. Sonin states the following:
Suppose $f\in C^2[a,b]$. Let $\rho(x)=\frac12-\{x\}$, where $\{x\}$ is the fractional part of $x$, and $\sigma(x)=\int^x_0\rho(t)\,dt$. Then $$ \sum_{a< n\leq b}f(n)=\int^b_a f(t)\,dt +\rho(b-)f(b)-\rho(a)f(a)-\big(\sigma(b)f'(b)-\sigma(a)f'(a)\big) +\int^b_a\sigma(t)\,f''(t)\,dt $$ where summation runs over all integers between $a$ and $b$.
This looks like integration by parts and Abel summation kind of thing. I tried to apply Riemann-Stieltjes formula directly but this did not quite work. Hints (or a sketch of proof) would be appreciated.