Okay, first I'm a bit ashamed to ask because I already asked a question yesterday about a similar question (it's from far not the same integral though), but I'm missing an $i$ somewhere in the process, that's why I'm asking haha.
I'm asked to evaluate the following integral : $$\int_{-\infty}^{\infty}\frac{\cos(z)}{(z^2+2z+2)^2}dz$$ which is the real part of
$$\int_{-\infty}^{\infty}\frac{e^{iz}}{(z^2+2z+2)^2}dz$$ which is much simpler to evaluate obviously.
The poles are at $z=-1\pm i$. I evaluate the integral in the upper half circle, so only $-1+i$ is in our domain. When I calculate the derivative (pole of order 2), I get $$\frac{1}{1!}\lim_{z\to-1+i}\frac{d}{dz}(z-(-1+i))^2\frac{e^{iz}}{(z^2+2z+2)^2} =\lim_{z\to-1+i}(z-(-1+i))^2 \frac{ie^{iz}(z^2+2z+2)-e^{iz}2(2z+2)}{(z^2+2z+2)^3} = \lim_{z\to-1+i}(z-(-1+i))^2 \frac{-e^{iz}2(2z+2)}{(z^2+2z+2)^3}=\frac{-4ie^{i(-1+i)}}{8i^3}=\frac{e^{-1-i}}{2}$$ But an $i$ seems to be missing given that when I multiply by $2\pi i$, I get $\pi ie^{-1-i}$ while WolframAlpha gets $\pi e^{-1-i}$. A real (and not imaginary) result would also make more sense given that we then have to take the real part of it to get the original integral with $cos(x)$.
As yesterday, I checked my work several times and couldn't find the mistake, that's why I'm asking haha.
Thanks for your help !
Edit : I forgot to include $(z-(-1+i))^2$ in the process. This is actually a typo, not a mistake.
I don't understand your method of computing that residue. Since$$\frac{e^{iz}}{(z^2+2z+2)^2}=\frac{e^{iz}}{(z+1+i)^2(z+1-i)^2}=\frac{\frac{e^{iz}}{(z+1+i)^2}}{(z+1-i)^2}$$and since the Taylor series of $\dfrac{e^{iz}}{(z+1+i)^2}$ about $-1+i$ is$$-\frac{e^{-1-i}}4-\frac{e^{-1-i}i}2(z+1-i)+\cdots,$$the residue that you're after is $-\dfrac{e^{-1-i}i}2$.