Error term of a Tauberian theorem and lattice points in circles Suppose $\{a_n\}$ is a sequence of non-negative real numbers, $a_n = O(n^M)$ for a positive number $M$ and it's Dirichlet series $L(s)=\sum \frac{a_n}{n^s}$ has an analytic continuation to a meromorphic function on $\mathbb C$ with only a simple pole at a positive real number $a$ with residue $A$. Using a standard Tauberian theorem (if I'm not forgot a necessary condition) one can conclude that:
$$\sum_{n\leq x} a_n = Ax^a + O(x^{a-\delta}). $$
My question is:

What is the maximum value of $\delta$ for which the above asymptotic formula works?

My motivation for this question was an effort to finding out the asymptotic of the number of lattice points in a circle with radius $\sqrt{N}$ with center at the origin which is closely related with Dedekind zeta function of $\mathbb Q[i]$. It turns out that this zeta function satisfies all of the above conditions for $a=1$ and $A=\frac{\pi}{4}$. So what is the best result one can obtain in this way?
 A: answer to the second question of Mostafa:(1). One can get the estimate $$\frac{\pi}{4}R+O(R^{1/2})$$ only by a short and elementary argument-people refer to it as the sphere packing technique of Gauss, you might have seen it is Calculus 1-essentially it is two dimensional Riemann integration where instead of approximating the integral with many arbitrarily small boxes you approximate it with a few squares of side $1$. Having therefore obtained the values $\delta=\frac{1}{2}$ so easily the question about Perron's formula is whether it can get a larger $\delta$. This is why I thought the first testing point would be at $\sigma=\frac{1}{2}$, as I mentioned earlier shifting the line of integration to the right and on $\Re(s)=\sigma$ will provide an error term which is at least as large as $O(x^{\sigma})$, the reason being the $x^s$ term in $$\int \zeta_{\mathbb{Q}(i)}(s) \frac{x^s}{s} ds.$$
(2): Indeed one can get $O(R^{1/3})$ using Voronoi summation-a smooth exposition of this proof (among many others) is Iwaniec+Kowalski's book (Lemma 4.9). Actually getting $O(R^{1/3})$ is the whole point of this approach compared to contour integration. Mind you, one can do contour integration and get this good error term but one needs a new idea, namely the approximate functional equation (have a look at Titchmarsh's zeta function book). But I should still say that the exponent $1/3$ is rather easy to get and one should try to read Huxley's papers instead (or at least the earlier delta symbol method of Iwaniec+Mozocci) that gives exponents much closer to Hardy's conjecture $\frac{1}{4}$.
A: There are many kinds of Tauberian theorems. In your particular setting what people mean by it is that they use the Mellin transform in a line of integration with real part $\sigma=\alpha+\frac{1}{\log x}$ and then shift the line of integration to the left of $\alpha$. There are three new integrals:two horizontal (which are the same basically) and one vertical. The former usually provide a small error term and the latter gives the main error term, meaning that if the new line of integration is on the line $\sigma=\alpha-\delta$ then one more or less has an error term of the form $O(x^{\alpha-\delta+\epsilon})$ for some $\epsilon>0$ depending on the behavior of the Dirichlet series in the region $\sigma>\alpha-\delta$. There is no automatic Tauberian theorem that gives you the resulting bound of this process in terms of the sequence $a_n$ however the process is very standard and it is easy to perform in particular examples. What I did not mention and is pretty important in this process is that you need to have good upper bounds for the growth of the Dirichlet series on the left of $\sigma=\alpha$. Lack of good bounds in this region is the reason one cannot get very good error terms even though the Dirichlet series can be analytically continued even further to the left. The reason one needs these bounds is that having better upper bounds reduces the value of $\epsilon>0$ in the error term above. For the specific application you have in mind the Dirichlet series is
$$\zeta_{\mathbb{Q}(i)}(s)=\zeta(s)L(s,\chi_4),$$
where $\chi_4$ is the non--trivial Dirichlet character modulo $4$
and one therefore needs good upper bounds for $\zeta(s)$ when the real part of $s$ is close to $\frac{1}{2}$. This is related to Lindelöf's hypothesis which is a weak version of Riemman's hypothesis but still far away from being proved. There are other techniques which quickly yield a better error term than the one you would get by a Tauberian argument, the simplest being Voronoi's summation (which gives $\alpha=1$ and allows any value $\delta>\frac{2}{3}$ in your notation). The best record for the error term in this application is due to Huxley and uses elementary techniques based on lattice point counting, perhaps it is not directly trivial to go through all the details in his paper though.
