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}

Edit: Much simpler answer: \begin{align}J_n(a)=\int_0^a\frac{\cos(n-2)x}{\cos^nx}\,dx&=\int_0^a\frac{\cos(n-1)x\cos x+\sin(n-1)x\sin x}{\cos^nx}\,dx\\&=\int_0^a\frac{\cos(n-1)x}{\cos^{n-1}x}-\frac{(-\sin x)\sin(n-1)x}{\cos^nx}\,dx\\&=\frac1{n-1}\int_0^a\frac d{dx}\frac{\sin(n-1)x}{\cos^{n-1}x}\,dx\\&=\frac{\sin(n-1)a}{(n-1)\cos^{n-1}a}\end{align} and taking $a=\pi/4$ gives the result.

We can also solve this using the complex exponential form of cosine: \begin{align}J_n&=\int_0^{\pi/4}\frac{\cos(n-2)x}{\cos^nx}\,dx\\&=2^{n-1}\int_0^{\pi/4}\frac{e^{(n-2)ix}+e^{-(n-2)ix}}{(e^{ix}+e^{-ix})^n}\,dx\\&=2^{n-2}\int_0^{\pi/2}\frac{e^{(n-1)it}+e^{it}}{(e^{it}+1)^n}\,dt\tag{$t=2x$}\\&=2^{n-2}\int_\gamma\frac{z^{n-2}+1}{i(z+1)^n}\,dz\tag{$\gamma(t)=e^{it},t\in[0,\pi/2]$}\\&=2^{n-2}\left[\frac{z^{n-1}-1}{i(n-1)(z+1)^{n-1}}\right]_{e^{i0}}^{e^{i\pi/2}}\\&=2^{n-2}\cdot\frac{i^{n-1}-1}{i(n-1)(i+1)^{n-1}}\\&=\frac{2^{n-2}}{i(n-1)}(w^{n-1}-\overline w^{n-1})\tag{$w=\frac i{i+1}=\frac{e^{i\pi/4}}{\sqrt2}$}\\&=\frac{2^{n-2}}{i(n-1)}\cdot\frac{2i\sin(n-1)\pi/4}{2^{(n-1)/2}}\\&=\frac{2^{(n-1)/2}}{n-1}\sin\frac{(n-1)\pi}4\end{align}
