Riemann–Von Mangoldt formula Let $$N(T) = \#\{\rho \in \mathbb{C}: \zeta(\rho) = 0,\, \operatorname{Im} \rho \in (0,T]\}$$ denote the number of zeros of $\zeta(s)$, counting multiplicities, with imaginary part lying in the interval $(0,T]$,  that is, with imaginary part greater than $0$ and less than or equal to $T$.  For example, one has $N(50) = 10$, since there are exactly 10 zeros of $\zeta(s)$ with  imaginary part lying in the interval $(0,50]$.  The Riemann–von Mangoldt formula,  conjectured by Riemann in 1859 and proved by von Mangoldt in 1905, states that
$$N(T)={\frac  {T}{2\pi }}\log {{\frac  {T}{2\pi }}}-{\frac  {T}{2\pi }}+O(\log {T}) \qquad (T \to \infty),$$ or, equivalently,
$$N(2 \pi T)=T \log T-T+O(\log {T}) \qquad (T \to \infty).$$
I'm wondering if more is known.  In particular, is there a known asymptotic expansion of $N(T)$ or $N(2 \pi T)$, or, perhaps even, an explicit formula?  (Pardon if there is an obvious reference for this.  I've been working in analytic number theory for only the last few years, and there are still some gaps in my knowledge that I'm trying to fill.)
 A: In addition to 2734364041's answer, this paper of Tim Trudgian may be useful: in particular, Trudgian shows that for all $T\geq e$,
$$\left|N(T)-\frac{T}{2\pi}\log\left(\frac{T}{2\pi e}\right)-\frac{7}{8}\right|\leq 0.112\log T+0.278\log\log T+2.510+\frac{0.2}{T}$$
and also includes a useful discussion of all the terms that go into this result.
A: As $T\to\infty$, we have
$$
N(T) = \frac{T}{2\pi}\log\frac{T}{2\pi}-\frac{T}{2\pi}+\frac{7}{8}+\frac{1}{\pi}\int_{\frac{1}{2}}^{\infty}\mathrm{Im}\Big(-\frac{\zeta'}{\zeta}(\sigma+iT)\Big)d\sigma+O(T^{-1}).
$$
This is proved in Chapter 15 of Davenport's Multiplicative Number Theory.  The error term $O(T^{-1})$ is a truncation for the asymptotic expansions for the arctan and gamma functions.  The contribution from the arctan function consists of lower order terms in a Taylor expansion, and the contribution from the gamma function consists of lower order terms in the Stirling expansion.
EDIT:  Because of the apparent lack of clarity regarding "arg" in this result, I replaced "$\arg \zeta(1/2+iT)$" with the corresponding integral, which should not be ambiguous.  I hope this helps.
A: You have also Guinand formula for $N(T)$, see, for example, in this answer
https://mathoverflow.net/a/104570/7402
A: Not sure why my answer received negative votes. I think it's correct.  Someone please point out my errors?
EDITED TO REFLECT @LUCIA'S COMMENTS: After digging through a bunch of references, I sorted out the answer I was looking for.  For all $T > 0$ except at the points of discontinuity of $N(2\pi T)$, one has
$$N(2 \pi T) =1+ \frac{1}{\pi} \theta(2\pi T) + \frac{1}{\pi}\operatorname{Arg}\zeta\left(\frac{1}{2}+2\pi i T\right)+2R(T),$$
where $\operatorname{Arg}$ is the principal branch of the argument, where $\theta(T)$ is the Riemann-Siegel theta function, and where $R(T)$ is an integer that is $O(\log T)$.  According to p. 98 of Davenport's book, you can get rid of the $R(T)$ integer term by replacing the principal value of $\arg \zeta(1/2+2 \pi i T)$ with the variation of $\arg \zeta(s)$ from $s = +\infty+2\pi iT$ to $1/2+2 \pi iT$ starting with value $0$, as long as  $T$ is not $\frac{1}{2\pi}$ times an ordinate of a zero of $\zeta(s)$.
By a known asymptotic expansion of $\theta(t)$, one has the asymptotic relation
\begin{align*}
N(2 \pi T) & =T \log T-T+\frac{7}{8}+\frac{1}{\pi}\operatorname{Arg}\zeta\left(\frac{1}{2}+2\pi i T\right)+2R(T)+O\left(\frac{1}{T}\right)  \\
& =   \int_1^T \log t \, dt -\frac{1}{8}+\frac{1}{\pi}\operatorname{Arg}\zeta\left(\frac{1}{2}+2\pi i T\right)+2R(T)+O\left(\frac{1}{T}\right) 
\end{align*}
and the asymptotic expansion
\begin{align*}
N(2 \pi T)  - \frac{1}{\pi}\operatorname{Arg}\zeta\left(\frac{1}{2}+2\pi i T\right)   \sim T \log T - T+ 2R(T) + \frac{7}{8}+\frac{1}{96 \pi^2 T}+ \frac{7}{11340\pi^4 T^3}+ \frac{31}{161280 \pi^6 T^5}+\cdots
\end{align*}
as $T \to \infty$, where the numerators and (1/2)denominators are as in OEIS Sequences A036282 and A114721, respectively.  Here is a plot of the function $N(2\pi T)$ and its smooth approximation  $1+\frac{1}{\pi}\theta(2\pi T)$.

