Improper Integral $\int\limits_0^\frac{1}{2}x^n\cot(\pi x)\,dx$ What is the closed form of the following integral for every $n\in\mathbb{N}$?
$$\int_0^\frac{1}{2}x^n\cot(\pi x)\,dx$$
By Mathematica we see that
$$\int_0^\frac{1}{2}x\cot(\pi x)\,dx=\frac{\log(2)}{2\pi}$$
$$\int_0^\frac{1}{2}x^2\cot(\pi x)\,dx=\frac{\pi^2\log(4)-7\zeta(3)}{8\pi^3}.$$
If there not exist a closed form, how one can prove these two formulas? 
 A: I can at least do the first one:$$\begin{align}\int_0^{\frac12}x\cot(\pi x)\text dx&=\left.\frac1\pi x\log(\sin(\pi x))\right|_0^{\frac12}-\int_0^{\frac12}\frac1\pi\log\sin(\pi x)\text dx\\
&=-\frac1{\pi^2}\int_0^{\pi/2}\log\sin x\ \text dx\tag 1\\
&=\frac{\log 2}{2\pi}\tag 2 \end{align}$$
Justification for $(1)$:
$$\begin{align} \lim_{x\to 0} x\log(\sin(\pi x))&=\lim_{x\to0} x\log(\pi x)\\
&=\lim_{x\to\infty} \frac{\log(x^{-1}\pi)}{x}\\
&=\lim_{x\to\infty} \frac{-\log\left(\frac x\pi\right)}{x}\\
&=0 \end{align}$$
Justification for $(2)$:
$$\begin{align} I&:=\int_0^{\pi/2}\log\sin x\,\text dx=\int_0^{\pi/2}\log\cos x\,\text dx\\
2I&=\int_0^{\pi/2}\log\sin x\,\text dx+\int_0^{\pi/2}\log\cos x\,\text dx\\
&=\int_0^{\pi/2}\log(\sin x\cos x)\,\text dx\\
&=\int_0^{\pi/2}\log\left(\frac12\sin (2x)\right)\text dx\\
&=-\frac\pi 2\log 2+\int_0^{\pi/2}\log\sin(2x)\,\text dx\\
&=-\frac\pi 2\log 2+\frac12\int_0^{\pi}\log\sin(x)\,\text dx\\
&=-\frac\pi 2\log 2+\frac12(2I)\\
I&=-\frac\pi 2\log 2 \end{align}$$
A: Your integral can be related to derivatives of the Hurwitz Zeta function. 
But, an interesting tidbit is that Ramanujan derived the formula:
$\displaystyle 1/2\int_{0}^{x}u^{n}\cot(u/2)du$
$\displaystyle=\cos(\frac{\pi n}{2})n!\zeta(n+1)-\sum_{k=0}^{n}(-1)^{\frac{k(k+1)}{2}}\frac{\Gamma(n+1)}{\Gamma(n+1-k)}x^{n-k}Cl_{k+1}(x)$
Where $Cl_{k+1}(x)$ is the Clausen function:
$\displaystyle Cl_{n}(x)=\Re [Li_{n}(e^{-ix})], \;\ \text{n odd} \;\ or \;\ -\Im [Li_{n}(e^{-ix})], \;\ \text{n even}$
Where $Li_{n}(e^{-ix})$ is the polylogarithm. 
For instance, $Li_{1}(e^{-i/2})=-\ln(1-e^{-i/2})=-\ln(2\sin(1/4))-(\frac{\pi}{2}-\frac{1}{4})i$
$\Re[Li_{2}(e^{ix})]=\frac{x^{2}}{4}-\frac{\pi x}{2}+\frac{\pi^{2}}{6}$.
So, for $x=-1/2$, we get $\frac{\pi^{2}}{6}+\frac{\pi}{4}+\frac{1}{16}$
A simple sub can whittle this more into your form. 
EDIT:
If I may add another very useful identity.  where p(x) is a polynomial like $x^{2}$ for instance. 
$\displaystyle \int_{a}^{b}p(x)\cot(nx)dx=2\sum_{k=1}^{\infty}\int_{a}^{b}\sin(2nkx)dx$.
provided $\sin(nx)\neq 0 \;\ \forall x \in [a,b]$
Let's do an example.  Say we want $\displaystyle \int_{0}^{\frac{1}{2}}x^{2}\cot(\pi x)dx=2\sum_{k=1}^{\infty}\int_{0}^{\frac{1}{2}}x^{2}\sin(2\pi kx)dx$
Integrating the right side results in the sums:
$\displaystyle-\frac{1}{4\pi}\sum_{k=1}^{\infty}\frac{(-1)^{k}}{k}+\frac{1}{2\pi^{3}}\sum_{k=1}^{\infty}\frac{(-1)^{k}}{k^{3}}-\frac{1}{2\pi^{3}}\sum_{k=1}^{\infty}\frac{1}{k^{3}}=\frac{\ln(2)}{4\pi}-\frac{1}{\pi^{3}}\cdot \frac{3}{8}\zeta(3)-\frac{1}{2\pi^{3}}\zeta(3)=\frac{\ln(2)}{4\pi}-\frac{7\zeta(3)}{8\pi^{3}}$
Thus, $\displaystyle \int_{0}^{1/2}x^{2}\cot(\pi x)dx=\frac{\ln(2)}{4\pi}-\frac{7\zeta(3)}{8\pi^{3}}$
