I am finding
$$\int_{-\infty}^{+\infty} \frac{e^x(1-e^x)}{1-e^{nx}}dx$$
for positive integer $n$.
I think maybe use contour integral. Let $w = nx$, we will get
$$\int_{-\infty}^{+\infty} \frac{e^x(1-e^x)}{1-e^{nx}}dx = \int_{-\infty}^{+\infty} \frac{e^{w/n}(1-e^{w/n})}{1-e^{w}}dw$$
Denominator $=0$ when $w=2\pi ki$, where $k\in\mathbb{Z}$. What is the proper contour for this?
Thank you.
Quite as dezdichado we substitute $e^x = t$ and get \begin{equation*} I = \int_{0}^{\infty}\dfrac{1-t}{1-t^n}\, dt. \end{equation*} To proceed we integrate $\dfrac{\log(z)(1-z)}{1-z^n}$, where \begin{equation*} \log(z) = \ln|z| + i\arg(z),\quad \text{ with } 0<\arg(z) < 2\pi , \end{equation*} around a keyhole contour. Then we get \begin{equation*} \int_{0}^{\infty}\dfrac{\log(t)(1-t)}{1-t^n}\, dt - \int_{0}^{\infty}\dfrac{(\log(t)+i2\pi)(1-t)}{1-t^n}\, dt = 2\pi i\sum_{k=1}^{n-1}{\rm Res}_{z=z_{k}}\dfrac{\log(z)(1-z)}{1-z^n} \end{equation*} where $z_{k} = \exp\left(\dfrac{2k\pi i}{n}\right)$. Consequently \begin{gather*} I = -\sum_{k=1}^{n-1}{\rm Res}_{z=z_{k}}\dfrac{\log(z)(1-z)}{1-z^n} = -\sum_{k=1}^{n-1}\dfrac{2k\pi i}{n}\dfrac{1-\exp\left(\dfrac{2k\pi i}{n}\right)}{-n\exp\left(\dfrac{2k\pi i(n-1)}{n}\right)} =\notag\\[2ex] \dfrac{2\pi i}{n^2}\sum_{k=1}^{n-1}k\left(\exp\left(\dfrac{2k\pi i}{n}\right)-\exp\left(\dfrac{4k\pi i}{n}\right)\right). \tag{1} \end{gather*} To calculate that sum we use that \begin{equation*} \sum_{k=0}^{n-1}z^k = \dfrac{z^n-1}{z-1}, \quad \text{ if } z\neq 1. \end{equation*} Differentiation followed by multiplication by $z$ yields \begin{equation*} \sum_{k=1}^{n-1}kz^k = \dfrac{nz^n}{z-1}-z\dfrac{z^n-1}{(z-1)^2}.\tag{2} \end{equation*} If $z = \exp\left(\dfrac{2k\pi i}{n}\right)$ or $z = \exp\left(\dfrac{4k\pi i}{n}\right)$ then $z^n = 1$ and we can use (2) to finish (1). \begin{equation*} I = \dfrac{2\pi i}{n^2}\left(\dfrac{n}{\exp\left(\dfrac{2\pi i}{n}\right)-1}- \dfrac{n}{\exp\left(\dfrac{4\pi i}{n}\right)-1}\right) = \dfrac{2\pi i}{n} \dfrac{\exp\left(\dfrac{2\pi i}{n}\right)}{\exp\left(\dfrac{4\pi i}{n}\right)-1} = \dfrac{\pi}{n\sin\left(\dfrac{2\pi}{n}\right)}. \end{equation*}