I want to calculate the following integral: $$\int\limits_{C_1}\frac{1-e^{iz}}{z^2} \ dz$$ in the limit $r\to0$. $C_1$ is a semi circle with radius $r$ in the complex plane ($z=re^{i\theta},0<\theta<\pi$).
Going through the textbook solution it says: $$\int\limits_{C_1}\frac{1-e^{iz}}{z^2} \ dz=\int\limits_{\pi}^{0}\frac{1-e^{ire^{i\theta}}}{r^2e^{2i\theta}}ire^{i\theta} \ d\theta=\ ...$$
I honestly don't know why the integration would go from $\pi$ to $0$ and not the other way around? I think this should have something to do with the direction I'm going around $C_1$ (my integration path) but I'm not sure how to argue this the correct way.
Any help would be really appriciated, thanks!
Update 1: Using $$ e^z-1=z+\frac12z^2+\cdots $$ then you can get \begin{eqnarray} &&\int_{C_1}\frac{1-e^{iz}}{z^2} \ dz\\ &=&-\int_{C_1}\frac{e^{iz}-1}{z^2} \ dz\\ &=&-\int_{C_1}\bigg(\frac{i}{z}-\frac{1}{2}-\frac1{3!}iz+\cdots\bigg) \ dz. \end{eqnarray} It is easy to see $$\lim_{r\to 0}\int_{C_1}\bigg(\frac{1}{2}+\frac1{3!}zi+\cdots\bigg) \ dz=0 $$ and $$ \int_{C_1}\frac{i}{z}\ dz=\int_0^\pi\frac{i}{re^{i\theta}}ir^{i\theta}d\theta=-\pi. $$ So $$\lim_{r\to 0}\int\limits_{C_1}\frac{1-e^{iz}}{z^2} \ dz=\pi. $$ Update 2: You also can use the Cauchy formula. Since $C_1$ is the half unit circle, you have $$ \int_{C_1}\frac{1-e^{iz}}{z^2} \ dz=\frac12\int_{|z|=1}\frac{1-e^{iz}}{z^2} \ dz=\frac12\cdot2\pi i\text{Res}(\frac{1-e^{iz}}{z^2},z=0)=\pi.$$