Riemann's Trick with Hankel Contour

I was reading a paper about analytic continuation of the Riemann $\zeta(s)$ function and stop in a step that I don't understand:

$$\int_0^\infty \frac{x^{ s -1} }{e^{x}-1} \,dx = \prod(s-1).\sum_{n=1}^\infty\frac{1}{n^s}$$

Here it says that it took the countour Integral: $$\int_{+\infty}^{+\infty} \frac{(-x)^{s} }{e^{x}-1} \,\frac{dx}{x}$$

And with that integral, use the countour from $+\infty$, around the origin, and going back to $+\infty$ (according to what I understand, this is a Hankel Contour)

Then, the integral is splitted in 3 parts (from the inf to origin, circle, and back to inf) and the reasoning continues...

Can anyone explain the purpose of this "trick"? What is the purpose of splitting the integral like that?

Why the contour is chosed like this?

Please help me, I am desperate


For $\Re(s) > 0$ $$\Gamma(s) = \int_0^\infty x^{s-1}e^{-x}dx$$ For $\Re(s) > 1$ $$\int_0^\infty \frac{x^{ s -1} }{e^{x}-1} \,dx = \sum_{n=1}^\infty \int_0^\infty x^{s-1}e^{-nx}dx=\sum_{n=1}^\infty n^{-s}\int_0^\infty x^{s-1}e^{-x}dx= \zeta(s)\Gamma(s)$$

With $C$ the contour following $(\infty,0]$ then enclosing $0$ then following $[0,\infty)$ we get $$\int_C \frac{x^{ s -1} }{e^{x}-1} \,dx = \int_\infty^0 \frac{x^{s-1}}{e^{x}-1}dx+\int_0^\infty \frac{(e^{2i\pi}x)^{s-1}}{e^{e^{2i\pi} x}-1}d(e^{2i\pi}x)= (e^{2i\pi (s-1)}-1)\zeta(s)\Gamma(s)$$

The point is that (from the Cauchy integral theorem) we can move contours for integrals of analytic functions, thus we can replace $C$ by a contour $\mathcal{C}$ enclosing $[0,\infty)$ clockwise but not passing through $0$ obtaining $$(e^{2i\pi (s-1)}-1)\zeta(s)\Gamma(s)=\int_\mathcal{C} \frac{x^{ s -1} }{e^{x}-1} \,dx$$

The latter integral converges for all $s$ and is an entire function of $s$

Finally for $\Re(s) < 0$ we can close the contour by adding an infinitely large circle and apply the residue theorem $$(e^{2i\pi (s-1)}-1)\zeta(s)\Gamma(s)=\int_{\mathcal{C}\cup |x|=\infty} \frac{x^{ s -1} }{e^{x}-1} \,dx$$ $$ = 2i\pi \sum Res(\frac{x^{ s -1} }{e^{x}-1}) = 2i\pi \sum_{k \ne 0} (2i\pi k)^{s-1}=(2i\pi)^s (1+(-1)^{s-1})\zeta(1-s)$$ The whole thing is the first step of Riemann's 1859 extraordinary paper.