TITLE: Reference request for the explicit formula for $\sum_{n\leq x} \Lambda(n)n^{-s}$
QUESTION [6 upvotes]: Denote by $\Lambda(n)$ th e von Mangoldt function, which is equal to $\log p$ if $p\geq 2$ is a prime, and $0$ otherwise. Let $\rho$ denote a complex zero of the Riemann $\zeta$-function. If i recall well, i once heard sometime ago that
$$\sum_{n\leq x} \Lambda(n)n^{-s} = -\frac{\zeta'}{\zeta}(s) + \frac{x^{1-s}}{1-s} - \sum_{|Im \rho| \leq x} \frac{x^{\rho-s}}{\rho-s} + O(\log^{2}x)$$ for $s\neq 1, s\neq \rho$ and $s\neq -2k, k\in \mathbb{N}$.
Does anyone have a reference for this result ?

REPLY [5 votes]: I don't know a reference off-hand, but here is a sketch of the proof (the details need to be checked carefully, and I have not done it). One can start from
$$\sum_{n\leq x}\frac{\Lambda(n)}{n^s}=\frac{1}{2\pi i}\int_{(\sigma)}-\frac{\zeta'(z)}{\zeta(z)}\cdot\frac{x^{z-s}}{z-s}\,dz,\qquad\sigma>\max(1,\mathrm{Re}\,s),$$
which is a variant of Theorem 5.1 in Montgomery-Vaughan: Multiplicative number theory I, and can be proved in the same way. As in the theorem, the RHS is understood as a Cauchy principal value, while in case of $x\in\mathbb{N}$ the term corresponding to $n=x$ in the LHS is counted with weight $1/2$.
The integrand is meromorphic with simple poles at $z=s$, $z=1$, and $z=\rho$. The corresponding residues are $-\zeta'(s)/\zeta(s)$, $x^{1-s}/(1-s)$, and $-m_\rho\cdot x^{\rho-s}/(\rho-s)$, where $m_\rho$ is the multiplicity of $\rho$. So one can derive the OP's display by performing the following steps:

Truncate the integral on the RHS to $|\mathrm{Im}\,z|\leq x$ and estimate the error introduced. Perturb $x$ slightly if it is very close to some $\mathrm{Im}\,\rho$.
Extend the truncated contour (which is a vertical line segment) to a rectangle containing the points $s=1$ and $s=0$, hence all the $\rho$'s with $|\mathrm{Im}\,\rho|\leq x$. By the Residue Theorem, the integral weighted by $1/(2\pi i)$ equals the sum of corresponding residues listed above.
Estimate the contribution of the horizontal line segments of the rectangular contour, as well as of the vertical line segment to the left of $s=0$.
The LHS equals the sum of residues listed in item 2, up to the error terms listed in items 1 and 3.

P.S. See also Terry Tao's valuable remarks below the original post.