Complex integration in Peskin and Schroeder In Peskin and Schroeder, I have a problem with a claim in equation (2.54), which I will rewrite more concisely here. He claims that we have the following equality :
$$ \frac{1}{2E_p}e^{-iE_p(x_0)}-\frac{1}{2E_p}e^{iE_p(x_0)} = \int\frac{dp_0}{2\pi i}\frac{-1}{(p_0-E_p)(p_0+E_p)}e^{-ip_0x_0}.\tag{2.54} $$
Where $x_0 > 0, E_p>0$ and the complex integral should be carried along a contour that avoids with semi-circles "from above" the two singularities at $E_p$, and $-E_p$, and closing it from below.
Now, I have two problems with that. First of all, it seems in his book he takes into account only the contributions of the residues, which give exactly the equation above. However, when doing carefully the integration along the small semicircles around the poles, we find that they both contribute, so that we obtain the right expression only up to a factor of 2, i.e.:
$$\int\frac{dp_0}{2\pi i}\frac{-1}{(p_0-E_p)(p_0+E_p)}e^{-ip_0x_0} = -2\pi i(\frac{1}{2E_p*2\pi i}e^{-iE_p(x_0)}-\frac{1}{2E_p*2\pi i}e^{iE_p(x_0)})+\pi i(\frac{1}{2E_p*2\pi i}e^{-iE_p(x_0)}-\frac{1}{2E_p*2\pi i}e^{iE_p(x_0)}) =  \frac{1}{4E_p}e^{-iE_p(x_0)}-\frac{1}{4E_p}e^{iE_p(x_0)}.$$
And this is done with the integration contour that he states, only it seems that he doesn't take into account the contribution of the small semicircles.
I think the problems stems from the fact that this integral is actually divergent, since we have first order poles on the real axis, so we need a prescription to regularise it. The one I did here, and the one he seems to be doing in his book, is using the principal value.
What I think he actually should have said in his book is that the prescription is the following:
$$\int\frac{dp_0}{2\pi i}\frac{-1}{(p_0-E_p+i\epsilon)(p_0+E_p+i\epsilon)}e^{-ip_0x_0}.$$
So that the poles are move from the real axis and then we don't have any contribution from the small semicircles.
Is this assumption right? Or have I somehow misunderstood/miscalculated Peskin's prescription?
P.S.: Since it was added in the comments, I detail here the semi-circle contribution, in case it is useful (which is, as stated in the answer, convergent ONLY if we take the principal value of the integral)
Let us do the integration along the semi-circle around $E_p$. The parametrisation is $z = E_p+\epsilon e^{i\theta}$ with $\theta \in [\pi,0]$(Note that in this parametrisation we implicitly took the principal value since the integration is symmetric around the pole). Writing the integral we obtain:
$$\int \frac{i \epsilon e^{i\theta}d\theta}{2\pi i} \frac{-1}{\epsilon e^{i\theta}(2E_p+\epsilon e^{i\theta})}\exp{\left(-i(E_p+\epsilon e^{i\theta})\right)}\\
= i\int_\pi^0 \frac{d\theta}{2\pi i} \frac{-1}{(2E_p+\epsilon e^{i\theta})}\exp{\left(-i(E_p+\epsilon e^{i\theta})\right)}.$$
Doing the series expansion in $\epsilon$ we see that all the terms that are of the form $e^{in\theta}$ vanish in the integration, so we can consider only the constant term which yields:
$$i\int_\pi^0 \frac{d\theta}{2\pi i} \frac{-1}{(2E_p)}e^{-i(E_p)} = \frac{1}{4E_p}e^{-iE_p}.$$
 A: *

*P&S don't write explicitly the integration contour
$$\begin{align}& -\int_{\color{red}{\gamma}}\frac{dp^0}{2\pi i}\frac{e^{-ip^0x^0}}{(p^0-E_{\bf p})(p^0+E_{\bf p})}\cr
~=~&-\frac{1}{2E_{\bf p}}\int_{\color{red}{\gamma}}\frac{dp^0}{2\pi i}e^{-ip^0x^0} \left(\frac{1}{p^0-E_{\bf p}}-\frac{1}{p^0+E_{\bf p}}\right)\end{align}$$
on the rhs. of eq. (2.54), but they mention in words and pictures that it is the retarded integration contour above the real axis
$$\begin{align}& -\int_{\color{red}{\mathbb{R}+i\epsilon}}\frac{dp^0}{2\pi i}\frac{e^{-ip^0x^0}}{(p^0-E_{\bf p})(p^0+E_{\bf p})}\cr
~=~&-\int_{\mathbb{R}}\frac{dp^0}{2\pi i}\frac{e^{-ip^0x^0}}{(p^0-E_{\bf p}+\color{red}{i\epsilon})(p^0+E_{\bf p}+\color{red}{i\epsilon})},\end{align}$$
which by the residue theorem is equal to
$$ \frac{1}{2E_{\bf p}}e^{-iE_{\bf p}x^0}-\frac{1}{2E_{\bf p}}e^{iE_{\bf p}x^0}$$
for $x^0>0$ (by closing the integration contour in the lower half-plane, clockwise).

*In particular, the integral on the rhs. of eq. (2.54) is not the principal value
$$-\color{red}{P}\int_{\mathbb{R}}\frac{dp^0}{2\pi i}\frac{e^{-ip^0x^0}}{(p^0-E_{\bf p})(p^0+E_{\bf p})},$$
which would lead to half the correct value (still assuming $x^0>0$).

