contour integral with singularity on the contour I want to compute the following integral 
$$\oint_{|z|=1}\frac{\exp \left (\frac{1}{z} \right)}{z^2-1}\,dz$$
The integrand has essential singularity at the origin, and $2$-poles at $\pm 1$,which lie on the curve $|z|=1$ so I can't apply residue formula. How can I proceed?
 A: The integral as posed does not exist.  No Cauchy principal value will help this.  I can, however, pose a problem that is very close that will produce a pretty nifty result.
Consider
$$\oint_C dz \frac{e^{1/z}}{z^2-1} $$
where $C$ is the following contour:

i.e., the circle $|z|=1$ with semicircular notches of radius $\epsilon$ cut into the circle at the poles $z=\pm 1$.  By Cauchy's theorem, this integral is zero.  However, we can use this fact to deduce a nontrivial integral.
The contour integral is also equal to
$$i \int_{-\pi/2}^{-\epsilon} d\theta \, e^{i \theta} \frac{e^{e^{-i \theta}}}{e^{i 2 \theta}-1} + i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{e^{1/(1+\epsilon e^{i \phi})}}{(1+\epsilon e^{i \phi})^2-1} \\ + i \int_{\epsilon}^{\pi-\epsilon} d\theta \, e^{i \theta} \frac{e^{e^{-i \theta}}}{e^{i 2 \theta}-1} + i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{e^{1/(-1+\epsilon e^{i \phi})}}{(-1+\epsilon e^{i \phi})^2-1} \\ + i \int_{\pi+\epsilon}^{3 \pi/2} d\theta \, e^{i \theta} \frac{e^{e^{-i \theta}}}{e^{i 2 \theta}-1} $$
Note that the point at which I started and ended the integration on the circle is arbitrary; I chose it so that I was able to encompass the small semicircles in their entirety rather than split them up.  Now take the limit as $\epsilon \to 0$, and I can simply express the Cauchy principal value over the circle over any interval of length $2 \pi$.  By Cauchy's theorem, we have
$$i PV \int_0^{2 \pi} d\theta \, e^{i \theta} \frac{e^{e^{-i \theta}}}{e^{i 2 \theta}-1} - i \frac{\pi}{2} e + i \frac{\pi}{2} e^{-1} = 0 $$
Now separate out real and imaginary parts.  With a little manipulation, we may conclude the following:
$$\int_0^{2 \pi} d\theta \frac{e^{\cos{\theta}} \sin{(\sin{\theta})}}{\sin{\theta}} = \pi \left ( e-\frac1{e}\right ) $$
$$PV \int_0^{2 \pi} d\theta \frac{e^{\cos{\theta}} \cos{(\sin{\theta})}}{\sin{\theta}} = 0$$
Sometimes it is interesting where these contour integrals can take us!
ADDENDUM
It is not trivial that the contour integral above is zero.  To show this, we need to expand the integrand in a Laurent series about $z=0$:
$$\frac{e^{1/z}}{z^2-1} = \left ( 1+\frac1{z} + \frac12 \frac1{z^2} + \cdots \right ) \frac1{z^2} \left (1+\frac1{z^2} + \cdots \right ) = \frac1{z^2} + \cdots$$
As there are no terms in $1/z$, the residue of this function at $z=0$ is zero, as is the integral.
