Prove that $\int_0^\frac{\pi}{4}\frac{\cos (n-2)x}{\cos^nx}dx=\frac{1}{n-1}2^\frac{n-1}{2}\sin\frac{(n-1)\pi}{4}$ 
Prove that
$$J_n=\int_0^\frac{\pi}{4}\frac{\cos (n-2)x}{\cos^nx}dx=\frac{1}{n-1}2^\frac{n-1}{2}\sin\frac{(n-1)\pi}{4}$$

For $n=2$, it is OK. For general $n$, it seems impossible by integration by parts. Any other method?
When I calculate an integral $I_n=\int_0^\frac{\pi}{4}\frac{\cos nx}{\cos^nx}dx$, we find $I_n/2^{n-1}-I_{n-1}/2^{n-1}=-1/2^{n-1}J_n$. So we need to find the $J_n$, as the problem states.
The proof of $I_n/2^{n-1}-I_{n-1}/2^{n-1}=-1/2^{n-1}J_n$ is as follows.
\begin{align}
I_n/2^{n-1}-I_{n-1}/2^{n-1}
&=\frac{1}{2^{n-1}} \int_0^\frac{\pi}{4}\left(\frac{\cos nx}{\cos^nx}-\frac{2\cos(n-1)x}{\cos^{n-1}x}\right)dx\\
&=\frac{1}{2^{n-1}}\int_0^\frac{\pi}{4}\frac{\cos[(n-1)x+x]-2\cos(n-1)x\cos x}{\cos^nx}dx\\
&=-\frac{1}{2^{n-1}}\int_0^\frac{\pi}{4}\frac{\cos(n-2)x}{\cos^nx}dx
=-1/2^{n-1}J_n
\end{align}

$$J_n=\int_0^\frac{\pi}{4}\frac{\cos (n-2)x}{\cos^nx}dx=\Re \,2^n\int_0^\frac{\pi}{4}\frac{e^{i(n-2)x}}{(e^{ix}+e^{-ix})^n}dx=\Re \,2^{n-1}\int_0^\frac{\pi}{2}\frac{e^{-it}}{(1+e^{-it})^n}dt$$
$$=\Re \,2^{n-1}(-i)\int_{-\frac{\pi}{2}}^0\frac{e^{it}}{(1+e^{it})^n}\,i\,dt$$
Consider the contour in the comples plane: from $0$ to $-i$ (along the axis $Y$), then - along a quarter circle - from $-i$ to $1$, and then from $1$ to $0$ along the axis $X$. There are no singularities inside this closed contour, therefore
$$\oint\frac{dz}{(1+z)^n}=0$$
On the other hand,
$$\oint\frac{z}{(1+z)^n}dz=\int_{-\frac{\pi}{2}}^0\frac{e^{i\phi}}{(1+e^{i\phi})^n}\,i\,d\phi+\int_1^0\frac{dz}{(1+z)^n}+\int_0^{-i}\frac{dz}{(1+z)^n}=0$$
$$\int_{-\frac{\pi}{2}}^0\frac{e^{i\phi}}{(1+e^{i\phi})^n}\,i\,d\phi=\int_0^1\frac{dz}{(1+z)^n}-\int_0^{-i}\frac{dz}{(1+z)^n}$$
Therefore,
$$J_n=\Re \,2^{n-1}(-i)\bigg(\int_0^1\frac{dz}{(1+z)^n}-\int_0^{-i}\frac{dz}{(1+z)^n}\bigg)$$
$$=\Re \,2^{n-1}\frac{i}{n-1}\Big(1-\frac{1}{(1-i)^{n-1}}\Big)=-\Re \,2^{n-1}\frac{i}{n-1}\frac{1}{(\sqrt2)^{n-1}}\frac{1}{e^{-\frac{\pi i(n-1)}{4}}}$$
$$J_n=\frac{2^\frac{n-1}{2}}{n-1}\sin\frac{\pi (n-1)}{4}$$
