Q:

Integral representation of cosecant function

According to Wolfram website http://functions.wolfram.com/ElementaryFunctions/Csc/introductions/Csc/05/, 
There exists a "well-known" integral representation for the cosecant function, i.e. $$\csc(z):=\frac{1}{\sin(z)} = \frac{1}{\pi}\int_0^{\infty} \frac{1}{t^2+t}t^{z/\pi}\,\mathrm d t$$
for complex $z$ such that $0< \Re(z)<\pi$.
I am searching for a demonstration of this formula. I can't find any reference book.
Ideally, I would like to find a similar integral representation on the whole complex plane except $\pi\mathbb{Z}$, or at least on the half plane with positive real part. It  may be an indefinite integral.

A:

$$\frac{1}{\pi}\int_0^{\infty}\frac{t^{\frac{z}{\pi}}}{t^2+t}dt=\frac{1}{\pi}\int_0^{\infty}\frac{t^{\frac{z}{\pi}-1}}{t+1}dt$$
Let $w=\dfrac{1}{t+1}:$
$$\begin{align*}\frac{1}{\pi}\int_0^{\infty}\frac{t^{\frac{z}{\pi}-1}}{t+1}dt&=\frac{1}{\pi}\int_0^{1}\frac{1}{w}\left(\frac{1}{w}-1\right)^{\frac{z}{\pi}-1}dw\\&=\frac{1}{\pi}\int_0^{1}w^{-\frac{z}{\pi}}\left(1-w\right)^{\frac{z}{\pi}-1}dw\\&=\frac{1}{\pi}\text{B}\left(1-\frac{z}{\pi},\frac{z}{\pi}\right)\end{align*}$$
Where $\text{B}(x,y)$ is the Beta function, defined for $\Re (x),\Re(y)>0$ (hence why we must have $0<\Re (z)<\pi$) 
By the powerful Beta-Gamma relation:
$$\frac{1}{\pi}\text{B}\left(1-\frac{z}{\pi},\frac{z}{\pi}\right)=\frac{1}{\pi}\Gamma\left(1-\frac{z}{\pi}\right)\Gamma\left(\frac{z}{\pi}\right)$$
Now, thanks to Euler's reflection formula:
$$\begin{align*}\frac{1}{\pi}\Gamma\left(1-\frac{z}{\pi}\right)\Gamma\left(\frac{z}{\pi}\right)&=\frac{1}{\pi}\cdot \pi\csc\left(\pi\cdot\frac{z}{\pi}\right)\\&=\csc (z)\end{align*}$$

