From Titchmarsh's The Theory of the Riemann Zeta-Function, page 13:
Let $\phi (x)$ be any function with a continuous derivative in the interval $[a,b]$. Then, if $[x]$ denotes the greatest integer not exceeding $x$, $$\sum_{a\lt n\le b}\phi (n)=\int_a^b \phi (x)\, dx+\int_a^b \left(x-[x]-\frac{1}{2}\right)\phi '(x)\, dx+\left(a-[a]-\frac{1}{2}\right)\phi (a)-\left(b-[b]-\frac{1}{2}\right)\phi (b).$$
There's no proof of this in the book and I don't know what's the 'name' of this theorem. I'd like to understand this theorem but don't know where to start at all.
Let $\rho(t)=\frac12 -(t-[t])=\frac{1}{2} - \{t\}$, where $\{t\}$ is the fractional part of $t$.
Sketch of proof:
I leave the details to you. Here is one way to approach this identity.
$$ \begin{align} -\int^\beta_\alpha f(t)\,dt &= \int^\beta_\alpha f(t)\rho'(t)\,dt\\ &=\rho(\beta-)f(\beta)-\rho(\alpha)f(\alpha)-\int^\beta_\alpha \rho(t)\,f'(t)\,dt \end{align} $$
You can now add over integer intervals $[k,k+1]\subset(a,b]$ and then over potentially fractional intervals $(a,[a]+1]$, $[[b],b]$ to obtain the desired result.
Edit: A more general and elegant proof can be obtained by integration by parts:
Lemma: Let $F$ and $G$ be right-continuous functions of locally finite variation on $I$, and let $\mu_G$, $\mu_F$ are the signed measures induced by $G$ and $F$ respectively. Then, for any compact interval $[a,b]\subset I$, $$ \begin{align} \int_{(a,b]} F(t)\,\mu_G(dt)=F(b)G(b)-F(a)G(a)-\int_{(a,b]}G(t-)\,\mu_F(dt) \end{align} $$ where $G(t-)=\lim_{s\nearrow t}G(s)$.
For the OP,
Consider the counting measure $\mu(dt)=\sum_{n\in\mathbb{Z}}\delta_{n}$ and the Lebesgue measure $\lambda$, both defined on $(\mathbb{R}\mathscr{B}(\mathbb{R}))$. Let$\phi(dt)=(\lambda-\mu)(dt)$. Notice that $\Phi(t):=\phi((0,t])=t-[t]=\{t\}$.
$$ \begin{align} \sum_{a< n\leq b}f(n)-\int^b_af(t)\,dt &=-\int^b_af(t)\,(\mu(dt)-\lambda(dt))=-\int^b_af(t)\phi(dt) \end{align} $$
Applying the Lemma above with $f$ in place of $F$ and $\Phi$ in place of $G$, we have that $\mu_f(dt)=f'(t)\,dt$ and $\mu_{\Phi}(dt)=\phi(dt)$ and so,
$$ \begin{align} \int^b_af(t)\phi(dt) &= f(t)\Phi(t)|^b_a -\int^b_a\Phi(t-)\, f'(t)\,dt\\ &=f(b)\{b\}-f(a)\{a\}-\int^b_a\Phi(t)\,f'(t)\,dt\\ &= f(b)(b-[b])-f(a)(a-[a)] -\int^b_a(t-[t])\,f'(t)\,dt \end{align} $$
where the change from $\Phi(t-)$ to $\Phi(t)$ follows from the fact that $\Phi(t-)=\Phi(t)$ $\lambda$-a.s.
The conclusion follows by adding and subtracting $\frac12$ in the last integral.