Criteria for formally derived Euler-Maclaurin-type formula Some time ago, while playing around with formal mathematics (in the second sense of this answer – just manipulating symbols without worrying about convergence and getting into analysis), I performed the following manipulation (here $L$ is the Laplace transform and $B_n$ are the Bernoulli numbers):
Let $q(x)$ be an arbitrary function, then:
$$\sum_{n=0}^{\infty}q(x+n)=\sum_{n=0}^{\infty}L\left[L^{-1}\left[q(s)\right](t)\right](x+n)$$
$$=\sum_{n=0}^{\infty}L\left[e^{-nt}L^{-1}[q(s)](t)\right](x)$$
$$=L\left[\sum_{n=0}^{\infty}e^{-nt}L^{-1}[q(s)](t)\right](x)$$
$$=L\left[\frac{1}{1-e^{-t}}L^{-1}[q(s)](t)\right](x)$$
$$=L\left[\left(\sum_{k=0}^{\infty}\frac{B_{k}(-1)^{k}t^{k-1}}{k!}\right)L^{-1}[q(s)](t)\right](x)$$
$$=L\left[\left(\sum_{k=0}^{\infty}\frac{B_{k}(-1)^{k}t^{k-1}}{k!}\right)L^{-1}[q(s)](t)\right](x)$$
$$=\sum_{k=0}^{\infty}L\left[\frac{B_{k}(-1)^{k}t^{k-1}}{k!}L^{-1}[q(s)](t)\right](x)$$
$$=\int_{x}^{\infty}q(s)ds-\sum_{k=1}^{\infty}\frac{B_{k}q^{[k-1]}(x)}{k!}$$
So we have the following identity for any $q(x)$:

$$\sum_{n=0}^{\infty}q(n)=\int_{0}^{\infty}q(s)ds-\sum_{k=1}^{\infty}\frac{B_{k}q^{[k-1]}(0)}{k!}\tag{*}$$

which seems to be at least vaguely similar to the Euler-Maclaurin formula. For $q(x)=e^{-ax}$ our formula is easily seen to be correct. It appears to work for other functions too, including appearing numerically to work for $q(x)=\frac{J_{1}(ax)}{x}$ for which it gives $\sum\limits_{n=1}^{\infty}\frac{J_{1}(an)}{n}=1-\frac{a}{4}$ where $J_1$ is the first Bessel function of the first kind. However, for $q(x)=e^{-x^2}$ we would get:
$$\sum_{n=0}^{\infty}e^{-n^2}=\frac{\sqrt{\pi}}{2}+\frac{1}{2}$$
But this is incorrect at the fourth decimal place. This is what interests me. I understand that my formal manipulation is not valid (presumably my interchanging summation and integration is not valid without uniform convergence). What I am interested in is whether $(*)$ can be rescued, or an expression for the error term found, and also whether anyone can explain (e.g. provide criteria) which functions will satisfy $(*)$ and which will not, since I cannot see why $e^{-ax}$ should and $e^{-x^2}$ should not (also if anyone could find an expression for the error in my summation of $\sum_\limits{n=0}^{\infty}e^{-n^2}$ that would be great).
(Note that I've already seen this which is specifically about evaluating $e^{-x^2}$ with the Euler-Maclaurin formula but does not answer my main question, and I've also seen this which is slightly similar to my own question but ends up deriving a slightly different formula by a somewhat different method, so it's not really applicable.)

Edit: My question about an expression for the error term in the formula for $e^{-x^2}$ has already been answered by Robert Israel below. My main question though is for an expression for the error term in $(*)$ and for an explanation of why certain functions (e.g. $e^{-ax}$) satisfy the formula and others (e.g. $e^{-x^2}$) do not, i.e. what are the criteria for the formula's validity?
 A: What you do have (under appropriate conditions) is the 
Poisson summation formula: 
$$ \sum_{n=-\infty}^\infty f(n) = \sum_{k=-\infty}^\infty \widehat{f}(k) $$
where $\widehat{f}(k)$ is the Fourier transform of $f$, with normalization
$$ \widehat{f}(k) = \int_{-\infty}^\infty e^{-2\pi i k x} f(x)\; dx $$
Thus for $f(x) = \exp(-x^2)$, $\widehat{f}(k) = \sqrt{\pi} \exp(-\pi^2 k^2)$
so that
$$\eqalign{\sum_{n = 0}^\infty \exp(-n^2) &= \dfrac{1}{2} + \dfrac{1}{2} \sum_{n=-\infty}^\infty \exp(-n^2) \cr &= \dfrac{1}{2} + \dfrac{\sqrt{\pi}}{2} \sum_{k=-\infty}^\infty \exp(-\pi^2 k^2)\cr
&= \dfrac{1+\sqrt{\pi}}{2} + \sqrt{\pi} \sum_{k=1}^\infty \exp(-\pi^2 k^2)}$$
A: Actually it is a special form of the Euler-Maclaurin summation formula. In the general form for infinite series the forumla is, for a summable $f\in C^{k}\left(\mathbb{R}\right)
 $ $$\sum_{n=0}^{\infty}f\left(n\right)=\int_{0}^{\infty}f\left(x\right)dx+\frac{1}{2}f\left(0\right)-\sum_{m=2}^{k}\frac{B_{m}}{m!}f^{\left(m-1\right)}\left(0\right)+R\left(k\right)
 $$ where $R(k)$ is the remainder therm and it has the bound $$\left|R\left(k\right)\right|\leq\frac{\zeta\left(k\right)}{\left(2\pi\right)^{k}}\int_{0}^{\infty}\left|f\left(x\right)^{\left(k\right)}\right|dx.
 $$ Now assume that $f\in C^{\infty}\left(\mathbb{R}\right)
 $. If $f$ is such that $$R\left(k\right)\rightarrow0
 $$ as $k\rightarrow\infty$ we have $$\sum_{n=0}^{\infty}f\left(n\right)=\int_{0}^{\infty}f\left(x\right)dx+\frac{1}{2}f\left(0\right)-\sum_{m=2}^{\infty}\frac{B_{m}}{m!}f^{\left(m-1\right)}\left(0\right)$$ which is essentially your identity. Unfortunately, this happens quite rarely.
