$\int_0^{\frac{\pi}{2}}x\cot(x)dx$ and $ \lim_{m \rightarrow \infty}\log\left( e^{2m}\left(\frac{(2m-1)!!}{(2m+1)^m}\right)^2\right)$. I'm trying to evaluate the integral, but in doing so have stumbled upon the limit, which I don't know whether it exists, and if so how to resolve it (and whether I've derived the relationship between the integral and limit correctly  [see below]). 
Derivation: First, use the cotangent formula: $$\cot(x)=\sum_{-\infty\le n\le\infty}\frac{1}{x+\pi n},$$
and apply it to the integral:
$$\int_0^{\frac{\pi}{2}}x\cot(x)dx=\sum_{-\infty\le n\le\infty}\int_0^{\frac{\pi}{2}}\frac{x}{x+\pi n}dx$$
$$=\sum_{-\infty\le n\le\infty}\int_{n \pi}^{\pi \left(n+\frac{1}{2}\right)}\frac{u- \pi n}{u}du$$
$$=\sum_{-\infty\le n\le\infty}[u-\pi n \log(u)]_{n \pi}^{\pi \left(n+\frac{1} {2}\right)},$$
and rearranging,
$$=\sum_{-\infty\le n\le\infty}\frac{\pi}{2}-\pi n \log\left(\frac{2n+1}{2n}\right)$$
$$=\frac{\pi}{2}\sum_{-\infty\le n\le\infty}  \log\left( e\left(\frac{2n}{2n+1}\right)^{2n}\right)$$
$$=\frac{\pi}{2}  \log\left( \prod_{-\infty\le n\le\infty} e\left(\frac{2n}{2n+1}\right)^{2n}\right).$$
Note that $$\prod_{-\infty\le n\le\infty} \left(\frac{2n}{2n+1}\right)^{2n}=  \prod_{1\le n\le\infty} \left(\frac{2n}{2n+1}\right)^{2n}\left(\frac{-2n}{-2n+1}\right)^{-2n} $$
$$=  \prod_{1\le n\le\infty} \left(\frac{2n-1}{2n+1}\right)^{2n} $$
$$=\left(\frac{1^1}{3^1}\cdot\frac{3^2}{5^2}\cdot\frac{5^3}{7^3}\cdots\right)^2=\lim_{m \rightarrow \infty}\left(\frac{(2m-1)!!}{(2m+1)^m}\right)^2.$$
Thus the original integral is equal to
$$\frac{\pi}{2}  \lim_{m \rightarrow \infty}\log\left( e^{2m+1}\left(\frac{(2m-1)!!}{(2m+1)^m}\right)^2\right).$$
 A: IMHO, it will be simpler if one integrate the integral by parts. Using answers from the question Evaluate: $\int_0^{\pi} \ln \left( \sin \theta \right) d\theta$, we have
$$\int_0^{\frac{\pi}{2}} x \cot x dx = \int_0^{\frac{\pi}{2}} x (\log \sin x)' dx
= \Big[x \log \sin x\Big]_0^{\frac{\pi}{2}} - \int_0^{\frac{\pi}{2}} \log\sin x dx\\
= - \int_0^{\frac{\pi}{2}} \log\sin x dx
= \frac{\pi}{2}\log 2$$
A: As mentioned in the comments, there are some issues regarding convergence in your calculation. These are not insurmountable, you can add a corrective term to the summands of the partial fraction decomposition of the cotangent,
$$\cot x = \frac1x + \sum_{n\in \mathbb{Z}\setminus\{0\}} \left(\frac{1}{x+\pi n} - \frac{1}{\pi n} \right),$$
to get a locally uniformly convergent series that allows interchange of summation and integration, you can pair up the terms for $n$ and $-n$ in the series before any manipulation,
$$\cot x = \frac1x + \sum_{n=1}^\infty \left(\frac{1}{x+\pi n} + \frac{1}{x-\pi n}\right) = 1 + 2\sum_{n=1}^\infty \frac{x}{x^2 - (\pi n)^2},$$
or you can explicitly consider the limit of symmetric partial sums,
$$\cot x = \lim_{N\to\infty} \sum_{n=-N}^N \frac{1}{x+\pi n}.$$
All these allow the performed manipulations since the corresponding series/sequence of symmetric partial sums for $x\cot x$ then converges uniformly on $\left[0,\frac{\pi}{2}\right]$.
With the understanding that the series and infinite products in your calculation are to be interpreted as the limits of symmetric partial sums/products, the computation is correct, and we have indeed
$$\int_0^{\pi/2} x\cot x\,dx = \pi\cdot \lim_{m\to\infty} \log \left(e^{m+1/2}\frac{(2m-1)!!}{(2m+1)^m}\right).$$
To evaluate that limit, it is helpful to rewrite the expression a little,
$$e^{m+1/2}\frac{(2m-1)!!}{(2m+1)^m} = e^{m+1/2}\frac{(2m)!}{2^mm!(2m+1)^m}.$$
Now we can use Stirling's formula
$$n! = \sqrt{2\pi n} \left(\frac{n}{e}\right)^n\cdot e^{\rho(n)},$$
where $\lim\limits_{n\to\infty}\rho(n) = 0$ (more precisely, $\frac{1}{12n+1} < \rho(n) < \frac{1}{12n}$, but we don't need that). Thus
$$\begin{align}
e^{m+1/2}\frac{(2m)!}{2^mm!(2m+1)^m} &= e^{m+1/2}\frac{2\sqrt{\pi m} (2m)^{2m}e^{-2m} e^{\rho(2m)}}{\sqrt{2\pi m}\cdot 2^mm^me^{-m} e^{\rho(m)}(2m+1)^m}\\
&= \sqrt{2}e^{1/2}\left(\frac{2m}{2m+1}\right)^m e^{\rho(2m) - \rho(m)}\\
&= \frac{\sqrt{2}\cdot e^{1/2}}{\left(1+\frac{1}{2m} \right)^m} e^{\rho(2m)-\rho(m)}\\
&\to \sqrt{2}.
\end{align}$$
Hence
$$\int_0^{\pi/2} x\cot x\,dx = \frac{\pi}{2}\log 2.$$
