Limit of an integral vs limit of the integrand I have a simple Fourier transform problem, originating from mathematical physics (system of linear PDEs), which reduces to taking the integral
$$
I(\alpha)\equiv\int_{-\infty}^\infty e^{ikr} \cfrac{\alpha^2 + \beta k^2}{k(k^2+\alpha^2)}\, dk
$$
where $\alpha$ and $\beta$ are some free real-valued parameters. I need to compute $I(0)$. It turns out that if I simply set $\alpha=0$ in the integral above, I get an absolutely different answer than if I first compute the integral and set $\alpha\to 0$ in the final expression.
My question is as follows: why do these two procedures lead to different answers? From the physical viewpoint this means that a massless field behaves in a totally different way than a massive with infinitesimal mass, which seems unreasonable.
My attempt is as follows.
I lift the pole at $k=0$ to the upper half-plane:
$$
I_\varepsilon(\alpha) \equiv \int_{-\infty}^\infty  e^{ikr} \cfrac{\alpha^2 + \beta k^2}{(k-i\varepsilon)(k+i\alpha)(k-i\alpha)}\, dk \equiv \int_{-\infty}^\infty \cfrac{g(k)}{h(k)}\, dk
$$
where 
$$
h(k) = (k-i\varepsilon)(k+i\alpha)(k-i\alpha)=k^3-i\varepsilon k^2+a^2k +i \varepsilon a^2,
$$
$$
h'(k)=3k^2-2ik\varepsilon+\alpha^2
$$
I take the integral making use of the Jordan's lemma and Cauchy theorem: I choose a contour in the upper half-plane $\mathbb H$, so that the integral reduces to the sum of residues at $k=i\varepsilon$ and $k=i\alpha$:
$$
I_1(\alpha)=2\pi i \lim_{\varepsilon \to 0}\left[\cfrac{g(i\varepsilon)}{h'(i\varepsilon)}+\cfrac{g(i\alpha)}{h'(i\alpha)}\right]
$$
$$
=2\pi i\lim_{\varepsilon\to 0}\left[ \cfrac{\alpha^2 + \beta (i\varepsilon )^2}{3(i\varepsilon )^2-2i(i\varepsilon )\varepsilon +\alpha^2}\,e^{-\varepsilon  r}+
    \cfrac{\alpha^2 + \beta (i\alpha)^2}{3(i\alpha)^2-2i(i\alpha)\varepsilon +\alpha^2}\,e^{-\alpha r} \right]
$$
$$
=2\pi i \left[ 1+
    \cfrac{1 - \beta}{-3+1} \right]=2\pi i \cfrac{1+\beta}{2}=\pi i(1+\beta).
$$
Thus, $I_1(\alpha) = \pi i(1+\beta)$. Clearly then, $\lim_{\alpha\to0}I_1(\alpha) = \pi i(1+\beta)$.
However, if I consider
$$
I_2\equiv I(\alpha=0)=
        \int_{-\infty}^\infty  e^{ikr} \cfrac{\beta}{k}\, dk = \lim_{\varepsilon \rightarrow 0}\int_{-\infty}^\infty  e^{ikr} \cfrac{\beta}{k-i\varepsilon }\, dk = \lim_{\varepsilon \rightarrow 0}2\pi i \beta e^{-\varepsilon  r} = 2\pi i \beta.
$$
Hence, $I_2\neq \lim_{\alpha\to0}I_1$!!! Please, give a hint why this sort of thing happens. I clearly understand that in my reasoning there is a flaw -- but it escapes me.
Thank you for any help!
 A: Care should be taken because of the pole at $k=0$, let me first take the principal value of the integral. I note that $I(\alpha,-r)=\bar{I}(\alpha,r)$ (complex conjugate), for convenience I will restrict myself to $r>0$.
The principal value integral evaluates to
$$I(\alpha,r)=\int_{-\infty}^\infty dk\, e^{ikr} \cfrac{\alpha^2 + \beta k^2}{k(k^2+\alpha^2)}=i\pi+i\pi(\beta-1)e^{-|\alpha|r}.$$
So for $\alpha=0$ the result is $I(0,r)=i\pi\beta$. There is no discontinuity at $\alpha=0$, but there is a discontinuous derivative. The same result would have been obtained if we would have set $\alpha=0$ before carrying out the integral, because the principal value integral $\int dk e^{ikr}k^{-1}=i\pi$ for $r>0$.
Alternatively, you could shift the pole off the real axis, still taking $r>0$ the answer then becomes
$$I(\alpha,r)=\lim_{\epsilon\downarrow 0}\int_{-\infty}^\infty dk\, e^{ikr} \cfrac{\alpha^2 + \beta k^2}{(k-i\epsilon)(k^2+\alpha^2)}=2i\pi+i\pi(\beta-1)e^{-|\alpha|r}.$$
So now $I(0,r)=i\pi(\beta+1)$, still continuous and with a discontinuous derivative.
We have recoved the result $I_1$, where the limit $\epsilon\downarrow 0$ is taken before the limit $\alpha\rightarrow 0$. These two limits do not commute, which is why the result $I_2$ in the OP differs from $I_1$.
A: It is not unreasonable that a massless field behaves in a way that is totally different from a massive one with arbitrarily small mass. Already at an elementary level, you can always perform a Lorentz transformation to the rest frame of a massive excitation; there is no such transformation for a massless one.
Whenever you encounter a mathematical ambiguity in a physics problem, it means that you have not taken into account all the necessary physics information. Physics has to tell you which order of limits is the relevant one. The $\epsilon $ prescriptions you are using usually serve to implement causality in the propagators you are evaluating - that may yield a clue. In mathematical terms: You are solving a PDE - what boundary conditions are you trying to satisfy?
Without knowing the full details of what you're calculating, one possibility is that you are considering the propagation of an actual massive particle, regardless of how small the mass is. In that case, $\epsilon $ has to be kept much smaller than $\alpha $, i.e., the order of limits is opposite to the case of the massless field. Another possibility is that you are treating the propagation of a massless particle, and merely introducing a mass as an infrared regulator at an intermediate stage. That is a rather subtle thing to do! One would then require that final physical results are not altered; e.g., that the additional polarization state induced for a photon is not counted in, say, a partition function.
A: Typically, you cannot pull limits out of an integration (unless there is a theorem that tells you that you can). When doing a contour integral, you have to be careful that all of the poles of the integrand stay away from the integration contour; here, your integration along the real axis gets "pinched" by the poles at $\pm\alpha$ as $\alpha\to0$, so the integral becomes non-analytic and the limits can definitely not be interchanged.
As for the statement that 

From the physical viewpoint this means that a massless field behaves in a totally different way than a massive with infinitesimal mass, which seems unreasonable[,]

note that a massless particle is fundamentally different from a massive one in many ways, so this is not at all unreasonable! Firstly, under the Poincaré group a massive particle has little group $\mathrm{SO}(3)$, but a massless particle has little group $\mathrm{E}(2)$, and hence a massive particle of spin $s$ has $2s+1$ spin states, but a massless one has 2 helicity states (regardless of $s$, for $s>0$). Secondly, a massless field gives a Coulomb potential, and a massive one a Yukawa potential, which have completely different behaviour at infinity (think of evaluating $\int r^n V(r) {\;\rm d}^3x$, $n\ge 1$ with a Yukawa and Coulomb potential for $V$, respectively).
