How to determinate poles and residues of this function. I have the following function
$$f(z)=\frac{e^{iz}}{e^z+e^{-z}}$$
Using the notaion $z= \rho(cos\theta+isen\theta)$ I found that the poles are $z_1=\frac{\pi}2i$ and $z_2=-\frac{\pi}2i$.
To determinate the residues i should do the following limits:
$$ \lim_{z \to \frac{\pi}2i}(z-\frac{\pi}2i)\frac{e^{iz}}{e^z+e^{-z}}$$ and $$ \lim_{z \to -\frac{\pi}2i}(z+\frac{\pi}2i)\frac{e^{iz}}{e^z+e^{-z}}$$   but i don't know how.
After that i have to calculate the follow integral:
$$\int_{-\infty}^{\infty} \frac{cosx}{coshx}\, dx$$I have that $$cosx=\frac{e^{ix}+e^{-ix}}2$$ and $$coshx=\frac{e^x+e^{-x}}2 $$ so it's easy to find the value of the integral with the Theorem of Residues. Could someone help me to find the residues? Thanks
 A: I think the asker may benefit from it,so i will give a whole derivation of the integral given in the question.
Because $\cosh(x)$ is periodic with respect to $ix\rightarrow ix + 2 \pi i$ we have an infinite number of solutions to the equation $\cosh(z)=0$ 
Writing $e^{z}+e^{-z}=0$ it is easy to deduce that the first will be $z_0=\pm i \frac{\pi}{2}$. 
Thanks to the periodicity mentioned above, we have  that the other solutions are just given by
$z_n=\pm i \frac{\pi}{2}(1+2 n),\quad n\in \mathbb{N}$
To calculate the actual integral, consider the complex function $$f(z)=\frac{\cos(z)}{\cosh(z)}$$ let's choose a rightangular contour with vertices $\{-R,R,R+i\pi,-R+i\pi\}$. 
We obtain
$$
\oint f(z)dz=\underbrace{\int_{-R}^Rf(x)dx}_{I_1}+\underbrace{\int_{0}^{ \pi}f(R+i y)dy}_{I_2}+\underbrace{\int_{R}^{-R}f(x+i \pi)dx}_{I_3}+\underbrace{\int_{\pi}^{0}f(R+i y)dx}_{I_4}\underbrace{=}_{\text{residue theorem}}2 \pi i \text{Res}(f(z),z=z_0)
$$
Taking the limit $R\rightarrow\infty$ we may conclude that $I_2=I_4=0$ because $\cosh(R)\sim \frac{e^R}{2}$ in this limit. Furthermore $I=I_1$ is the integral we are looking for. To make sense out of $I_3$ we use the identities $\cosh(x+i\pi)=-\cosh(x)$ and $\cos(x+i\pi)=\cosh (\pi ) \cos (x)-i \sinh (\pi ) \sin (x)$
 We therefore can rewrite our contour integral as follows:
$$
\oint f(z)dz=\underbrace{\int_{-\infty}^{\infty}\frac{\cos(x)}{\cosh(x)}+\int_{-\infty}^{\infty}\frac{\cosh(\pi)\cos(x)}{\cosh(x)}}_{I(1+\cosh(\pi))}+i\underbrace{\int_{-\infty}^{\infty}\frac{\sinh(\pi)\sin(x)}{\cosh(x)}}_{=0\quad\text{due to parity}}=2\pi i \text{Res}(f(z),z=z_0)
$$  
Using  for example the formula for the residue suggested by @DanielFischer in the comments we find $\text{Res}(f(z),z=z_0)=-i \cosh \left(\frac{\pi }{2}\right)$
Putting everything together this yields 
$$I=2\pi\frac{\cosh \left(\frac{\pi }{2}\right)}{1+\cosh(\pi)}=\frac{\pi}{\cosh\left(\frac{\pi}{2}\right)}$$
