closed form for $I(n)=\int_0^1\left ( \frac{\pi}{4}-\arctan x \right )^n\frac{1+x}{1-x}\frac{dx}{1+x^2}$
For $n=2$ we have, integrating by parts, $$I\left(2\right)=\int_{0}^{\pi/4}x^{2}\cot\left(x\right)dx=\frac{\pi^{2}}{16}\log\left(\frac{1}{\sqrt{2}}\right)-2\int_{0}^{\pi/4}x\log\left(\sin\left(x\right)\right)dx $$ and now we can use the Fourier series of $\log\left(\sin\left(x\right)\right)$ $$\log\left(\sin\left(x\right)\right)=-\log\left(2\right)-\sum_{k\geq1}\frac{\cos\left(2kx\right)}{k},\,0<x<\pi$$ and so $$I\left(2\right)=\frac{\pi^{2}}{16}\log\left(\frac{1}{\sqrt{2}}\right)+\frac{\pi^{2}}{16}\log\left(2\right)+2\sum_{k\geq1}\frac{1}{k}\int_{0}^{\pi/4}x\cos\left(2kx\right)dx $$ $$=\frac{\pi^{2}}{32}\log\left(2\right)+\pi\sum_{k\geq1}\frac{\sin\left(\frac{\pi k}{2}\right)}{4k^{2}}+\frac{1}{2}\sum_{k\geq1}\frac{\cos\left(\frac{\pi k}{2}\right)}{k^{3}}-\frac{1}{2}\zeta\left(3\right) $$ and now since $$\cos\left(\frac{\pi k}{2}\right)=\begin{cases} -1, & k\equiv2\,\mod\,4\\ 1, & k\equiv0\,\mod\,4\\ 0, & \textrm{otherwise} \end{cases} $$ we have $$\frac{1}{2}\sum_{k\geq1}\frac{\cos\left(\frac{\pi k}{2}\right)}{k^{3}}=\frac{1}{2}\sum_{k\geq1}\frac{\left(-1\right)^{k}}{8k^{3}}=-\frac{3}{64}\zeta\left(3\right) $$ using the relation between the Dirichlet eta function and the Riemann zeta funcion. Similary, since $$\sin\left(\frac{\pi k}{2}\right)=\begin{cases} -1, & k\equiv3\,\mod\,4\\ 1, & k\equiv1\,\mod\,4\\ 0, & \textrm{otherwise} \end{cases} $$ we have $$\sum_{k\geq1}\frac{\sin\left(\frac{\pi k}{2}\right)}{k^{2}}=\sum_{k\geq1}\frac{\left(-1\right)^{k-1}}{\left(2k-1\right)^{2}}=K $$ where $K$ is the Catalan's constant. Finally we have $$I\left(2\right)=\frac{\pi^{2}}{32}\log\left(2\right)+\frac{\pi}{4}K-\frac{35}{64}\zeta\left(3\right).$$ Addendum: As tired notes, this method can be generalized for a general $n$. I will write only a sketch of the proof. Integrating by parts we have $$I\left(n\right)=\int_{0}^{\pi/4}x^{n}\cot\left(x\right)dx=\frac{\pi^{n}}{4^{n}}\log\left(\frac{1}{\sqrt{2}}\right)-n\int_{0}^{\pi/4}x^{n-1}\log\left(\sin\left(x\right)\right)dx $$ and using the Fourier series we get $$I\left(n\right)=\frac{\pi^{n}}{4^{n}}\log\left(\frac{1}{\sqrt{2}}\right)+\frac{\pi^{n}}{4^{n}}\log\left(2\right)+n\sum_{k\geq1}\frac{1}{k}\int_{0}^{\pi/4}x^{n-1}\cos\left(2kx\right)dx$$ $$=\frac{\pi^{n}}{2^{2n+1}}\log\left(2\right)+\frac{n}{2^{n}}\sum_{k\geq1}\frac{1}{k^{n+1}}\int_{0}^{k\pi/2}y^{n-1}\cos\left(y\right)dy$$ and now the last integral can be calculated using an iterating integration by parts. We will get series very similar to the other case, which can be treated with the same techinques.