Is $\pi (x)=\operatorname{R}(x)-\sum_{\rho}\operatorname{R}(x^{\rho})$ correct at all? 
It should be the case that, in some appropriate sense
$$\pi (x)\sim \operatorname{Ri}(x)-\sum_{\rho}\operatorname{Ri}(x^{\rho}) \tag*{(4)}$$
with $\operatorname{Ri}$ denoting the Riemann function defined:
$$\operatorname{Ri}(x)=\sum_{m=1}^\infty \frac{\mu (m)}{m}\operatorname{li}\left(x^{\frac{1}{m}}\right). \tag*{(5)}$$
This relation $(4)$ has been called "exact" [in Ribenboim's The New Book of Prime Number Records], yet we could not locate a proof in the literature; such a proof should be nontrivial, as the conditionally convergent series involved are problematic. In any case relation $(4)$ is quite accurate, and furthermore the Riemann function $\operatorname{Ri}$ can be calculated efficiently (...) The sum in $(4)$ over critical zeros is not absolutely convergent, and furthermore the phases of the summands interact in a frightfully complicated way.

—from Journal of Computational and Applied Mathematics by Borwein et al.

Of profound importance, Bernhard Riemann proved that the prime-counting function is exactly
$$\pi (x)=\operatorname{R}(x)-\sum_{\rho}\operatorname{R}(x^{\rho})$$
where
$$\operatorname{R}(x)=\sum_{n=1}^\infty \frac{\mu (n)}{n}\operatorname{li}\left(x^{\frac{1}{n}}\right),$$
(...) $\rho$ indexes every zero of the Riemann zeta function, and $\operatorname{li}\left(x^{\frac{\rho}{n}}\right)$ is not evaluated with a branch cut but instead considered as $\operatorname{Ei}\left(\frac{\rho}{n}\ln x\right)$. Equivalently, if the trivial zeros are collected and the sum is taken only over the non-trivial zeros $\rho$ of the Riemann zeta function, then $\pi (x)$ may be written
$$\pi (x)=\operatorname{R}(x)-\sum_{\rho}\operatorname{R}(x^{\rho})-\frac{1}{\ln x}+\frac{1}{\pi}\arctan\frac{\pi}{\ln x}.$$

—from Wikipedia's Prime counting function article (before 30/7/2021)
Questions:

*

*According to Borwein and Ribenboim, the index in $(4)$ should run only over non-trivial zeros. According to Wikipedia, the index in $(4)$ should run over all zeros. Wikipedia states that if the sum runs only over non-trivial zeros, then we add the $\ln$ and $\arctan$ terms, which is even more confusing. So what's true?


*I'm pretty sure that Riemann did not prove the formula $(4)$. He only proposed a "weaker" form of it, namely
$$\pi (x)=\sum_{m=1}^\infty \frac{\mu (m)}{m}J\left(x^{\frac{1}{m}}\right)$$
where
$$J(x)=\operatorname{li}(x)-\sum_{\rho}\operatorname{li}\left(x^{\rho}\right)+\int_x^\infty \frac{dt}{t(t^2-1)\ln t}-\ln 2$$
and where $\rho$ runs over all non-trivial zeros. The formula was proven by Mangoldt, not Riemann. The Wikipedia article is wrong in that historical fact, isn't it?


*Even though the proof of $(4)$ is nowhere to be found in the literature, Raymond Manzoni provided a partial proof here. I call it partial because it is unknown whether the series converges at all: How could that be settled down?
Note: When I refer to the formula $(4)$ in this question, I assume $=$ instead of $\sim$.
Riesel and Gohl
Riesel and Gohl show in Some Calculations Related to Riemann's Prime Number Formula that
$$\sum_{n=1}^N \frac{\mu (n)}{n}\left(\int_{x^{\frac{1}{n}}}^\infty \frac{\mathrm dt}{t(t^2-1)\ln t}-\ln 2\right)=\frac{1}{2\ln x}\sum_{n=1}^N \mu (n)+\frac{1}{\pi}\arctan\frac{\pi}{\ln x}+\epsilon (x,N)$$
where
$$\epsilon (x,N)=-\sum_{n=N+1}^\infty \frac{\mu (n)}{n}\left(\frac{1}{2}\ln\ln x+C\right)+\frac{1}{2}\sum_{n=N+1}^\infty \frac{\mu (n)\ln n}{n}+\sum_{n=N+1}^\infty \frac{\mu (n)}{n}\sum_{k=1}^\infty \frac{1}{\pi k}\arctan\frac{\ln x}{n\pi k}$$
where
$$C=\sum_{k=1}^\infty \frac{1}{\pi k}\arctan\frac{1}{\pi k}+\int_1^\infty \frac{\mathrm du}{u(e^{2u}-1)}-\ln 2+\frac{1}{2}.$$
Now, $\epsilon\to 0$ as $N\to\infty$.
If $\sum_{n=1}^\infty \mu (n)=-2$, then
$$\sum_{n=1}^\infty \frac{\mu (n)}{n}\int_{x^{\frac{1}{n}}}^\infty \frac{\mathrm dt}{t(t^2-1)\ln t}=\frac{1}{\pi}\arctan\frac{\pi}{\ln x}-\frac{1}{\ln x}.$$
But this uses the zeta-regularized result $\sum_{n=1}^\infty \mu (n)=-2$. It is one way of assigning a finite value to a divergent sum, obtained by just plugging $s=0$ in
$$\frac{1}{\zeta (s)}=\sum_{n=1}^\infty \frac{\mu (n)}{n^s}.$$
In general, this assigning of values is arbitrary. There are lots of ways to do that. I don't understand how can this arbitrary choice produce an "empirically-correct" result about the distribution of prime numbers. In fact, the paper of Riesel and Gohl implies the mysterious formula
$$\pi (x)= \operatorname{R}(x)-\sum_{\rho}\operatorname{R}(x^{\rho})-\frac{1}{\ln x}+\frac{1}{\pi}\arctan\frac{\pi}{\ln x}.$$
For the empirical results, see here.
Questions [continued]:


*What makes zeta-regularization (or other regularizations producing the same value) the only regularization that seems to produce the "empirically-correct" result? Or is it the case that the result is ultimately wrong?

Note: $\operatorname{li}x$ is to be interpreted as the Cauchy principal value of $\operatorname{Ei}\ln x$.
This question has been on MSE for some time, but it still doesn't have any answers, so I decided to post it here.
Edit:
The Wikipedia formula (before 30/7/2021)
$$\pi (x)= \operatorname{R}(x)-\sum_{\rho}\operatorname{R}(x^{\rho})-\frac{1}{\ln x}+\frac{1}{\pi}\arctan\frac{\pi}{\ln x}$$
turned out to be a misinterpretation of Riesel and Gohl.
 A: Preliminaries. We will denote the slight modifications of the prime counting function and the prime power counting function with $\pi^*$ and $J^*$ respectively, which assume a halfway step at discontinuities. Furthermore we will denote the non-trivial zeros of the zeta function with $\rho$ and all zeros i.e. the trivial and non-trivial zeros with $\varrho$ in questions two to four.
Q1. It depends on what the meaning of $\sim$ in the statement $\pi^* (x)\sim \operatorname{Ri}(x)-\sum_{\rho}\operatorname{Ri}(x^{\rho})$ is. Putting convergence questions aside, which we will discuss in Q3, we indeed have an equality if the sum runs over all zeros of $\zeta$. If we omit the trivial zeros, the statement might still be correct, if $\sim$ denotes asymptotic equivalence since $\sum_n\operatorname{Ri}(x^{-2n})=o(1).$ This is because
$$\left\lvert\lim_{x\to\infty}\sum_n\sum_m \frac{\mu(m)}{m}\operatorname{li}(x^{-2n/m})\right\rvert \leqslant \lim_{x\to\infty}\sum_n\sum_m \frac{1}{m}\left\lvert\operatorname{li}(x^{-2n/m})\right\rvert\overset{\text{(Tonelli)}}{=}0.$$
Q2. "Proposed" might not be the best fitting word. Riemann showed and proved essential ideas of his, while leaving out certain steps, which caused a certain lack of rigor. Hence, Riemann's proof was not complete. Quoting Edwards, p.38, 1.19 QUESTIONS UNRESOLVED BY RIEMANN:

Riemann evidently believed that he had given a proof of the product formula for $\zeta(s)$, but, at least from the reading of the paper given above, one cannot consider his proof to be complete, and, in particular, one must question Riemann's estimate of the number of roots $\rho$ in the range $\{0 < \operatorname{Im} \rho < T\}$ on which this proof is based. It was not until 1893 that Hadamard proved the product formula, and not until 1905 that von Mangoldt proved the estimate of the number of roots in $\{0 < \operatorname{Im} \rho < T\}$.

Q3. We want to prove that $\pi^*(x)=\operatorname{R}(x)-\sum_{\varrho} \operatorname{R}(x^{\varrho})$ follows from $\pi^*(x)=\sum_{m=1}^{\infty}\frac{\mu(m)}{m}J^*(x^{1/m})$. Define $\pi_X^*\colon \mathbb R_{>1}\to\mathbb N$ as $$x\mapsto\sum_{m\leqslant X}\frac{\mu(m)}{m}J^*(x^{1/m}),$$
where $X>1$. If $X>\log_2(x)$, then $\pi_X^*(x)=\pi^*(x)$, since $J^*(x)=0$ for $x<2$. After applying Möbius inversion on $J^*$ we get that for all $X>\log_2(x)$
$$\pi^*(x)=\sum_{m\leqslant X}\frac{\mu(m)}{m}\operatorname{li}(x^{1/m})-\sum_{\varrho}\sum_{m\leqslant X}\frac{\mu(m)}{m}\operatorname{li}(x^{\varrho/m})-\log 2\sum_{m\leqslant X}\frac{\mu(m)}{m}.$$
We were able to change the order of summation involving the conditional convergent series since the series over $m$ is finite. Now the idea is not to look at the case $X\to\infty$ separately. There exists an $N\in\mathbb N$ for every $X>1$ so that $\pi^*_X(x)=\pi^*_N(x)$. The sequence $(\pi_N^*)_{N\in\mathbb N}$ converges since it is Cauchy.
Q4. Riesel's and Göhl's objective was to find an approximation and not an exact form of the last two terms of $\pi_N(x)$, $\sum_{n=1}^N \frac{\mu (n)}{n}\left(\int_{x^{\frac{1}{n}}}^\infty \frac{\mathrm dt}{t(t^2-1)\ln t}-\ln 2\right)$. The integral is equivalent to $\sum_m\operatorname{li}(x^{-2n/m})$. They eventually showed that it is equal to $\frac{1}{2\ln x}M(N)+\frac{1}{\pi}\arctan\frac{\pi}{\ln x}+\epsilon (x,N),$ where $M$ denotes the Mertens function and $\epsilon$ is an error term, which tends to zero as $N\to\infty$. In order to make the calculation more efficient they replace the Mertens function with $-2$ and argue on page 979 as follows:

It is thus advantageous to choose such a value of $N$ that the sums $g_k$ become comparatively small. It also is advantageous to have $\sum_1^N\mu(n) = -2$ at the same time, since (32) then has the order of magnitude only $= O((\log x)^{-3})$ instead of $O((\log x)^{-1})$.

Here no zeta regularization was used. The triple sums in the error term are dependent on $g_k$. There exist infinitely many $N$ such that $M(N)=-2$. This immediately follows from the bounds $\liminf~M(n)/\sqrt n < -1.009$ and $\limsup~M(n)/\sqrt n > 1.06$, which were used to disprove the Mertens conjecture.
