Contour integral:
oint_C f(z) = int_-R^R f(w) dw + int_S f(z) dz = 2pi i sum "Res" f(z)
C anti-clockwise
Note that if C is clockwise, then there is a minus sign in front of 2pi i sum"Res" f(z) .
f(z) = 1/(z+i epsi)
Poles: z = -i epsi
"Res" f(-i epsi) = lim_(z rarr -i epsi) (z+i epsi) f(z) = 1
The path of C is a straight line from -R to R followed by a semi-circle from R to -R in the lower half-plane (since epsi > 0). Now the direction of the contour is clockwise:
lim_(epsi rarr 0^+) int_-R^R f(w) dw = - 2pi i "Res" f(-i epsi) - lim_(epsi rarr 0^+) int_S f(z) dz
Take: z = Ae^(itheta)
lim_(epsi rarr 0^+) int_S f(z) dz = lim_(epsi rarr 0^+)int_(-pi)^0 (Aie^(itheta))/(Ae^(itheta)+i epsi)d theta = int_(-pi)^0 id theta = pi i
So: lim_(epsi rarr 0^+) int_-R^R 1/(w+i epsi) dw = - pi i