Complex integral $\int \frac{e^{iz}}{(z^2 + 1)^2}\,dz$ with Cauchy's Integral Formula.
First note that the integrand has two singularities at $z=\pm i$ both of which are enclosed by the contour $|z|=3$. You can use the Generalized form of Cauchy's Integral Formula to solve this without residues, but to do so we need to split the contour integral into the sum of two separate contours that each enclose only one singularity of the integrand.
One obvious way to do so is to split the whole circle $|z| = 3$ into two positively-oriented semicircles which share a diameter on the real axis.
Since one contour integrates along the diameter to the right and the other to the left, they cancel and hence the sum of our two semicircle contours is the same as the original circle. I'll name the upper semicircle $U$ and the lower $L$. We can use Cauchy's Integral Formula on each of these contours.
The Generalized Cauchy Integral Formula says that if we have some contour $C$ enclosing some point $z_0$ and we have a function $f$ that is holomorphic on the enclosure of $C$, then $$ \int_C \frac{f(z)}{(z-z_0)^{n+1}} \, dz = \frac{2\pi i}{n!} f^{(n)}(z_0) $$ for any $n = 0, 1, 2, ...$
We can use this to evaluate the integral about $U$ by rewriting the integrand like so: \begin{align} \frac{e^{iz}}{(z^2+1)^2} &= \frac{e^{iz}}{(z^2-(-1))^2} \\ &= \frac{e^{iz}}{(z+i)^2 (z-i)^2} \\ &= \frac{e^{iz}/(z+i)^2}{(z-i)^2} \end{align} The numerator is holomorphic on the enclosure of $U$ (because its only singularity is at $z=-i$ which is outside of $U$). Hence Cauchy's Integral Formula tells us that \begin{align} \int_U \frac{e^{iz}/(z+i)^2}{(z-i)^2} \, dz &= \frac{2\pi i}{1!} \cdot \frac{d}{dz} \left[\frac{e^{iz}}{(z+i)^2} \right](z=i) \\ &= 2\pi i \cdot \left(-\frac{i}{2e} \right) \\ &= \frac{\pi}{e} \end{align} Likewise the integral about $L$ can also be computed by rewriting the integrand as $$ \frac{e^{iz}}{(z^2+1)^2} = \frac{e^{iz}/(z-i)^2}{(z+i)^2} $$ By applying Cauchy's Integral Formula again for this integral you will find that \begin{align} \int_L \frac{e^{iz}/(z-i)^2}{(z+i)^2} \, dz &= 0 \end{align} The integral about the original contour $|z| = 3$ must be the sum of these two integrals. So \begin{align} \int_\Gamma \frac{e^{iz}}{(z^2+1)^2} \, dz &= \frac{\pi}{e} + 0 \\ &= \boxed{\frac{\pi}{e}} \end{align}
The only singular points of the meromorphic function $f(z)=\frac{e^{iz}}{(z^2+1)^2}$ are the double poles at $\pm i$.
The given integration contour encloses both of them: the residue at $z=i$ is $-\frac{i}{2e}$ and the residue at $z=-i$ is zero, hence the given integral equals $2\pi i\cdot\left(-\frac{i}{2e}\right)=\color{red}{\large\frac{\pi}{e}}$ by the residue theorem.
$$\int \frac{e^{iz}}{(z^2 + 1)^2}\,dz$$ for residue in $z=i$ write $$\frac{e^{iz}}{(z^2 + 1)^2}=\frac{e^{iz}}{(z+i)^2(z-i)^2}=\dfrac{\frac{e^{iz}}{(z+i)^2}}{(z-i)^2}$$ with $f(z)=\dfrac{e^{iz}}{(z+i)^2}$ then $$Res_{z=i}2\pi i\Big(f'(z)\Big)\Big|_{z=i}=\dfrac{\pi}{e}$$ other residue in $z=-i$ in similar way is $0$, so the integral will be $$\dfrac{\pi}{e}+0=\color{blue}{\dfrac{\pi}{e}}$$