Extracting Dirichlet series coefficients Cauchy's integral formula is a powerful method to extract the $n$'th power series coefficient of an analytic function by evaluating a single complex integral. Is there any such analytic method to extract (ordinary) Dirichlet series coefficients? That is, assuming that a given function $f(s)$ admits a Dirichlet series expansion $$\sum_n a_n n^{-s},$$ is there any known method to compute a desired coefficient $a_n$?
 A: Yes. If $f(s)$ has a finite abscissa of absolute convergence $\sigma_a$, then $\forall \sigma > \sigma_a$:
$$
\lim_{T\to\infty} \frac{1}{2T} \int_{-T}^{T} f(\sigma+ it)n^{it} \mathrm{d}t = \frac{a_n}{n^{\sigma}}.
$$
IIRC, the proof can be found in Apostol's book on Analytic Number Theory.
A: Even for more general Dirichlet series
$$f(z)=\sum_{0}^\infty a_n e^{-\lambda_nz}$$
there is the formula
$$a_ne^{-\lambda_n\sigma}=\lim_{T\to\infty}\frac{1}{T}\int_{t_0}^Tf(\sigma+it)e^{\lambda_n it}dt,$$
where $t_0$ is arbitrary (real) and $\sigma>\sigma_u$, the abscissa of uniform convergence.
This formula determines both $\lambda_n$ and $a_n$: the RHS=0 when we integrate against $e^{i\lambda t}$ with $\lambda\neq \lambda_n$.
The class of functions which can be represented by such a series is called (analytic) almost periodic functions (on a vertical line $\{s=\sigma+it:t\in R\}$). The "number-theoretic case" corresponds to $\lambda_n=n$.
Ref. S. Mandelbrojt, Series de Dirichlet, Paris, Gauthier-Villars, 1969.
Dirichlet series with complex $\lambda_n$ have been also studied (by A. F. Leont'ev and his school).
