I'm having difficulties as to evaluating the complex integral. Also, how should I use its result to evaluate the real valued integral ?
Integrate the function $$f(z) = \frac{z}{1 - a e^{-i z}} ;\: a > 1$$ around a suitable rectangle to show $$\int_0^\pi \frac{a x \sin x}{1 - 2 a x \cos x + a^{2}} dx = \pi \ln \left(1 + \frac{1}{a} \right).$$