<s>[INST] Closed form of $\int_0^\infty \left(\frac{\arctan x}{x}\right)^ndx$ I know that for $n=1$ the integral is divergent and that for $n=2$ the integral has a closed form. However, I wonder if the general expression has a closed form.
My attempt: $$\int_0^\infty \left(\frac{\arctan(x)}{x}\right)^ndx=\frac{n}{1-n}\int_0^\infty\frac{\arctan^{n-1}(x)}{x^{n-1}(x^2+1)}dx=\frac{n}{1-n}\int_0^{(\frac{\pi}{2})^{n-1}} u^{n-1}\cot^{n-1}\left(u^{1/(n-1)}\right)du$$
I don't know if I'm on the right track here or not but I do not know through what methods to evaluate the last integral. Any help is appreciated.
 [/INST] As user90369 doesn't have the time apparently I thought I repesent my own solution explicitly for those interested.
Starting with 
\begin{align}
\int_{-\pi/2}^{\pi/2} \frac{x^n \left(\cos x\right)^{n-2}}{\left(\sin x\right)^n} \, {\rm d}x &\stackrel{y=2x}{=} 2^{-n+1} \, i^n \int_{-\pi}^{\pi} y^n \, e^{-iy} \, \frac{\left(1+e^{-iy}\right)^{n-2}}{\left(1-e^{-iy}\right)^n} \, {\rm d}y \\
&\stackrel{z=e^{iy}}{=} -i \, 2^{-n+1} \int_\gamma \left(\log z\right)^n \, \frac{(z+1)^{n-2}}{(z-1)^n} \, {\rm d}z
\end{align}
where $\gamma$ is the unit circle in positive direction. The integrand is holomorph off the negative real line and the contour can be deformed to only enclose the cut $[-1,0]$.
Then
\begin{align}
&=i \, 2^{-n+1} (-1)^n \int_0^1 \frac{(1-z)^{n-2}}{(1+z)^n} \, \left\{ \left(\log z + i\pi\right)^n - \left(\log z - i\pi\right)^n \right\} {\rm d}z \\
&=2^{-n+2} (-1)^{n+1} \sum_{k=0}^n \sum_{p=0}^{n-2} \sum_{q=0}^\infty  \begin{pmatrix} n \\ k \end{pmatrix} \begin{pmatrix} n-2 \\ p \end{pmatrix} \begin{pmatrix} -n \\ q \end{pmatrix} (-1)^p \pi^{n-k} \sin\left(\frac{\pi}{2}(n-k)\right) \\
&\qquad \times \int_0^1 z^{p+q} \, \left( \log z \right)^k \, {\rm d}z
\end{align}
and using the two formulas
\begin{align}
\int_0^1 x^n \, \left(\log x\right)^m \, {\rm d}x &=  \frac{(-1)^m \, m!}{(n+1)^{m+1}} \tag{1} \\
\begin{pmatrix} -n \\ q \end{pmatrix} &= (-1)^q \begin{pmatrix} n+q-1 \\ q \end{pmatrix} = (-1)^q \, \frac{(q+1)\cdots(q+n-1)}{(n-1)!} \\ &= \frac{(-1)^q}{(n-1)!} \sum_{m=0}^{n-1} \left[ {n-1 \atop m} \right] (q+1)^m \tag{2}
\end{align}
with the Stirling numbers of the first kind we arrive at
\begin{align}
=2^{-n+2} (-1)^{n+1} \sum_{k=0}^n \sum_{p=0}^{n-2} \sum_{m=0}^{n-1} \sum_{q=0}^\infty   \begin{pmatrix} n-2 \\ p \end{pmatrix} \left[ {n-1 \atop m} \right]  \frac{(q+1)^m (-1)^{k+p+q} \pi^{n-k} n! \sin\left(\frac{\pi}{2}(n-k)\right)}{(p+q+1)^{k+1} (n-1)! (n-k)!} \, .
\end{align}
Next we reverse the summation $k \rightarrow n-k$ and decompose another time the factor $(q+1)^{m}=(p+q+1-p)^{m}$ in the nominator
\begin{align}
&=-2^{-n+2}\,n \sum_{k=0}^n \sum_{p=0}^{n-2} \sum_{m=0}^{n-1} \sum_{l=0}^m \begin{pmatrix} n-2 \\ p \end{pmatrix} \left[ {n-1 \atop m} \right] \begin{pmatrix} m \\ l \end{pmatrix} (-p)^{m-l} \\
&\qquad \frac{(-\pi)^{k}  \sin\left(\frac{\pi}{2}k\right)}{k!} \sum_{q=0}^\infty \frac{(-1)^{q+p}}{(p+q+1)^{n-k-l+1}} \\
&=-2^{-n+2} \, n \sum_{k=0}^n \sum_{p=0}^{n-2} \sum_{l=0}^{n-1} \sum_{m=l}^{n-1} \begin{pmatrix} n-2 \\ p \end{pmatrix} \left[ {n-1 \atop m} \right] \begin{pmatrix} m \\ l \end{pmatrix} (-p)^{m-l}\\
&\qquad \frac{(-\pi)^{k} \sin\left(\frac{\pi}{2}k\right)}{k!} \left\{ \eta\left(n-k-l+1\right) -\sum_{q=1}^p \frac{(-1)^{q+p}}{(p-q+1)^{n-k-l+1}}  \right\} \tag{3}
\end{align}
where $\eta(s)$ is the Dirichlet Eta-Function.
It seems as if
\begin{align}
&\quad \sum_{p=0}^{n-2} \sum_{q=1}^{p} \sum_{l=0}^{n-1} \sum_{m=l}^{n-1} \begin{pmatrix} n-2 \\ p \end{pmatrix} \left[ {n-1 \atop m} \right] \begin{pmatrix} m \\ l \end{pmatrix} \frac{(-p)^{m-l} (-1)^{q+p}}{(p-q+1)^{n-k-l+1}} \\
&=\sum_{p=0}^{n-2} \sum_{q=1}^{p} \begin{pmatrix} n-2 \\ p \end{pmatrix} \frac{(-1)^{q+p}}{(p-q+1)^{n-k+1}} \sum_{m=0}^{n-1}  \left[ {n-1 \atop m} \right](-q+1)^m \\
&=(-1)^{n-1}(n-1)! \sum_{p=0}^{n-2} \sum_{q=1}^{p} \begin{pmatrix} n-2 \\ p \end{pmatrix} \begin{pmatrix} q-1 \\ n-1 \end{pmatrix} \frac{(-1)^{q+p}}{(p-q+1)^{n-k+1}} \\
&= 0 \, ,
\end{align}
since $q\leq n-2$ and $\begin{pmatrix} n-3 \\ n-1 \end{pmatrix}=0$, so the second term in the curly bracket does not contribute.
Here is a Maple Code of the result (3) for verification:
restart; 
n := 5; 
eta := proc (s) options operator, arrow; limit((1-2^(1-S))*Zeta(S), S = s) end proc; 
r1 := simplify(-2^(-n+2)*n*add(add(add(add(binomial(n-2, p)*Stirling1(n-1, m)*(-1)^(n-1-m)*binomial(m, l)*(-p)^(m-l)*(-Pi)^k*sin((1/2)*Pi*k)*eta(n-k-l+1)/factorial(k), m = l .. n-1), l = 0 .. n-1), p = 0 .. n-2), k = 0 .. n)); 
r2 := simplify(int(x^n*cos(x)^(n-2)/sin(x)^n, x = -(1/2)*Pi .. (1/2)*Pi)); 
evalf([r1, r2])

</s>