what is the proper contour for $\int_{-\infty}^{\infty}\frac{e^z}{1+e^{nz}}dz$ what is the proper contour for $$\int_{-\infty}^{\infty}\frac{e^z}{1+e^{nz}}dz:2\leq n$$
I tried with rectangle contour but the problem which I faced how to make the contour contain all branches point because $1+e^{nz}=0$ for every $z=\frac{2k+1}{n}$ :$k\in Z$
,or how to avoid them 
 A: Here is another solution for diversity.
In your integral, let $x\mapsto\log x$, so it becomes
$$\int_{0}^\infty \frac{dz}{1+z^n}=\frac{1}{n}\int_{0}^\infty \frac{z^{1/n-1}\,dz}{1+z}$$
The latter integral can be solved with a keyhole contour (and this avoids the branch cut along $\mathbb R^+$), as the integrand disappears around $\infty$.  The residue at $-1$ equals
$$b= e^{i\pi(1/n-1)}$$
where we use the principal branch of $\log$.  As the argument increases by $2\pi$, the integrand multiplies by $e^{2\pi i (1/n-1)}$
$$\left(1-e^{2\pi i (1/n-1)}\right)\int_{0}^\infty \frac{z^{1/n-1}\,dz}{1+z}=2\pi i e^{i\pi(1/n-1)}\implies \int_{0}^\infty \frac{z^{1/n-1}\,dz}{1+z} = \pi \csc\left(\frac \pi n\right)$$
Multiplying this by $1/n$, we obtain the value:
$$\frac{\pi}{n\sin\left(\frac{\pi}{n}\right)}$$
A: Set $w=nz$, then your integral is equal to $\displaystyle\frac{1}{n}\int_{\mathbb R}\frac{e^{w/n}}{1+e^w}\,dw=\frac{I}{n}$. Now, for $M>0$ big, consider the following rectangle contour: $$t_1\in[-M,M],\\ M+t_2i,\,t_2\in[0,2\pi],\\t_3+2\pi i,\,t_3\in[M,-M],\\-M+t_4i,t_4\in[2\pi,0].$$ On the second line, $$|I|\leq\int_0^{2\pi}\left|\frac{e^{M/n+ti/n}}{1+e^{M+ti}}\right|\,dt\leq\int_0^{2\pi}\frac{e^{M/n}}{|e^{M+ti}|-1}\,dt\leq2\pi\frac{e^{M/n}}{e^M-1},$$ which goes to $0$ as $M\to\infty$. Similarly for the fourth line. On the third line, we get $$-\int_{-M}^M\frac{e^{t/n+2\pi i/n}}{1+e^{t+2\pi i}}\,dt\to-e^{2\pi i/n}I,$$ as $M\to\infty$. Now, the residue on $\pi i$ is equal to $-e^{\pi i/n}$, so you have that $$I(1-e^{2\pi i/n})=-2\pi ie^{\pi i/n}\Rightarrow I=\frac{2\pi i}{e^{\pi i/n}-e^{-\pi i/n}}=\frac{\pi}{\sin(\pi/n)},$$ therefore your integral is equal to $\displaystyle\frac{\pi/n}{\sin(\pi/n)}$.
