An integral which is derived from Jacobi's Sum of Two Squares Theorem by Complex Analysis Here is an integral that I'm having trouble with. I have got to this integral by trying to prove Jacobi's sum of two squares by complex analysis. And here is it:
$$I:= \int_{-\infty}^{\infty} \frac{\operatorname{csch}(x) \sin (2x)}{\cos (2x) - \cosh (\pi)}\mathrm{d}x=\pi \coth\left(\frac{\pi}{2}\right) - \frac{1}{2}B \left(\frac{1}{4}, \frac{1}{4}\right)$$
My step so far:
It is well-known that:
$$\sum_{n=1}^\infty 2 \pi (-1)^{n-1} \mathrm{e}^{-\omega \pi n} \sin(\pi \kappa n) =  
    \frac{2 \pi  e^{\pi  \omega } \sin (\pi  \kappa )}{2 e^{\pi  \omega } \cos (\pi 
   \kappa )+e^{2 \pi  \omega }+1}$$$$=\frac{\pi   \sin (\pi  \kappa )}{\cos (\pi 
   \kappa )+\cosh\left( \pi  \omega \right)}$$
By substitution $k = t+1$ cause we know that $\cos\pi (t+1) = - \cos \pi t$:
$$2\cdot\sum_{n=1}^\infty  \mathrm{e}^{-\omega \pi n} \sin(\pi t n) =  \frac{   \sin (\pi t )}{\cosh\left( \pi  \omega \right)-\cos (\pi  t)}$$
Now let $\omega = 1$ and $ t = \frac{2x}{\pi}$. We obtain:
$$2\cdot\sum_{n=1}^\infty  \mathrm{e}^{-\pi n} \sin\left( 2nx\right) =  \frac{   \sin (2x )}{\cos (2x)-\cosh\left( \pi  \right)}$$
Plug this infinite representation in our integral:
$$ I = -2\cdot\sum_{n=1}^\infty  \mathrm{e}^{-\pi n} \int_{-\infty}^{\infty} \frac{\sin (2nx)}{\sinh(x)} \mathrm{d}x$$
Each integral inside is fairly easy to compute. Indeed, one can use Laplace transform:
$$\int_{-\infty}^{\infty} \frac{\sin (2nx)}{\sinh(x)} \mathrm{d}x = 2 \int_{0}^{\infty} \frac{\sin (2nx)}{\sinh(x)} \mathrm{d}x=4  \int_{0}^{\infty} \frac{e^{-x}\sin (2nx)}{1- e^{-2x}} \mathrm{d}x$$$$=4\sum_{i=0}^{\infty} \int_{0}^{\infty} \sin(2nx) e^{-(2n+1)x} \mathrm{d}x= \pi \tanh\left(n\pi \right) $$
The last inequality is obtained by the fact that: $\tanh \left(\frac{\pi x}{2}\right) = \frac{4x}{\pi} \sum_{k\geq 1} \frac{1}{(2k-1)^2 + x^2}$. Therefore:
$$I: = 2\pi \sum_{n=1}^{\infty} e^{-\pi n} \tanh(\pi n)$$
And I'm stuck here because I don't know how to connect this sum with the result above. Indeed, I can derive a further result by using $\tanh(x)$ generating summation which is:
$$\tanh (x) = 1+ 2\sum_{n=1}^{\infty}\frac{(-1)^n}{e^{2nx}}$$
However, I can't still be able to get the Beta Function to appear. Hope anyone can help me to derive the result above. Thank you so much.
UPDATE: So I am trying to prove the relation without using Jacobi's two square theorem or elliptical function:
$$\left(\sum_{n=-\infty}^{\infty}e^{-\pi n^2}\right)^2 = \sum_{n = - \infty}^{\infty} \frac{1}{\cosh \left(\pi n\right)}$$
Actually, I intend proving this by constructing an complex integral and make use of Residue Theorem of the function $\displaystyle f(z) = \frac{1}{2i} \cot (\pi z) \mathrm{sech} (\pi z) $ over the contour which has a square shape from $-N - \frac{1}{4}$ to $N + \frac{1}{4}$ on the real axis and likewise on the imaginary axis. Since $N \to \infty$, $f(z) \to 0$, by calculating the residue, I obtained:
$$\sum_{n=-\infty}^{\infty} \mathrm{sech}(\pi n) = \sum_{n=-\infty}^{\infty} (-1)^n \coth \left(\frac{\pi}{2}(2n+1)\right)$$
Then, in order to evaluate the LHS of $(1)$, I used Abel–Plana formula for the divergent series on the RHS which is:
$$\sum_{n=0}^{\infty} (-1)^n f(n) = \frac{f(0)}{2} + i\int_0^{\infty} \frac{f(it) - f(-it)}{2\mathrm{sinh}(\pi t)} \mathrm{d}t$$
Rewrite the RHS of $(1)$ and then apply this formula since $\coth (z)$ is holomorphic in the region $\Re{(z)} \geq 0$. Finally, I use the result of:
$$\sum_{n=-\infty}^{\infty}e^{-\pi n^2}=\frac{\sqrt[4]{\pi}}{\Gamma\left(\frac{3}{4}\right)}$$
By Euler's reflection formula, I got the integral above. Therefore, if one can prove the result above indenpendently, we can have another way proving Jacobi's two square theorem via complex analysis.
 A: This is a long comment (exposition of my comment to the question). Please do respond by updating your question.
The Jacobi two square theorem is equivalent to the following identity $$\left(\sum_{n\in\mathbb {Z}} q^{n^2}\right)^2=1+4\sum_{n\geq 1}\frac{q^n}{1+q^{2n}}\tag{1}$$ The final sum expression for your integral $I$ can be written as $$I=-2\pi\sum_{n\geq 1}\frac{q^n(1-q^{2n})}{1+q^{2n}}=2\pi\sum_{n\geq 1}\left(q^n-\frac{2q^n}{1+q^{2n}}\right)=\frac{2\pi q} {1-q}-4\pi\sum_{n\geq 1}\frac{q^n}{1+q^{2n}}$$ where $q=e^{-\pi} $ (you have a minor sign typo in your question).
Now an explicit evaluation of the above sum is itself based on the equation $(1)$ and the integral becomes $$I=\pi(1-\vartheta_{3}^2(q))+\frac{2\pi q} {1-q}$$ where $\vartheta_3(q)=\sum_{n\in\mathbb {Z}} q^{n^2}$ is a theta function defined by Jacobi.
Explicit evaluation of $\vartheta_{3}(q)$ is possible if $q=\exp(-\pi\sqrt{r}), r\in\mathbb {Q} ^{+} $ via a complicated theorem of Selberg and Chowla. The evaluation is easy and famous for $q=e^{-\pi} $.
However I don't see an explicit evaluation without using the Jacobi two square theorem $(1)$. Can you give some more details about your version of Jacobi two square theorem and some indication of how your arrive at your integral while trying to prove it. A direct algebraic proof of $(1)$ is available on this website.
