Here is yet another way to proceed. We have the integral of interest $I$ which is defined as
$$\begin{align}
I_n&\equiv \frac{8}{\pi}\int_0^{\pi/4}\sec x\cos(4nx)dx\\\\
&=\text{Re}\left(\frac{8}{\pi}\int_0^{\pi/4}\sec x\,e^{i4nx}dx\right) \tag 1
\end{align}$$
We will evaluate $I_n$ in $(1)$ using the method of contour integration. To that end, we analyze the contour integral $J_n$ defined as
$$J_n\equiv \text{Re}\left(\frac{16}{i\pi}\oint_C \frac{z^{4n}}{z^2+1}dz\right)$$
where $C$ is the "pie-shaped" contour that is comprised of
$(C_1)$ the line segment along the real axis from $(0,0)$ to $(1,0)$
$(C_2)$ the arc along the unit circle from $(1,0)$ to $(\sqrt{2}/2,\sqrt{2}/2)$
$(C_3)$ the line segment from $(\sqrt{2}/2,\sqrt{2}/2)$ to $(0,0)$
From the residue theorem,
$$J_n=0 \tag 2$$
since $\frac{z^{4n}}{z^2+1}$ is analytic in $C$.
The integral $J_n^{(1)}$ over $C_1$ is given by
$$\begin{align}
J_n^{(1)} &= \text{Re}\left(\frac{16}{i\pi}\int_0^1 \frac{x^{4n}}{x^2+1}dx\right)\\\\
&=0 \tag 3
\end{align}$$
since $\int_0^1 \frac{x^{4n}}{x^2+1}dx$ is purely real.
The integral $J_n^{(2)}$ over $C_2$ is given by
$$\begin{align}
J_n^{(2)} &= \text{Re}\left( \frac{16}{i\pi}\int_0^{\pi/4} \frac{(e^{ix})^{4n}}{(e^{ix})^2+1}ie^{ix}dx\right)\\\\
&=\text{Re}\left(\frac{8}{\pi}\int_0^{\pi/4}\frac{e^{i4nx}}{\cos x}dx\right)\\\\
&=\frac{8}{\pi}\int_0^{\pi/4}\sec x\cos (4nx)dx\\\\
&=I_n \tag 4
\end{align}$$
The integral $J_n^{(3)}$ over $C_3$ is given by
$$\begin{align}
J_n^{(3)}&= \text{Re}\left(\frac{16}{i\pi}\int_1^0\frac{(e^{i\pi/4}t)^{4n}}{(e^{i\pi/4}t)^2+1}e^{i\pi/4}dt\right)\\\\
&=\frac{(-1)^n16}{\pi\sqrt{2}}\int_0^1\frac{t^{4n}(t^2-1)}{t^4+1}dt \tag 5
\end{align}$$
Using $(2)-(5)$ reveals that
$$I_n=\frac{(-1)^{n+1}16}{\pi\sqrt{2}}\int_0^1\frac{t^{4n}(t^2-1)}{t^4+1}dt \tag 6$$
We now examine the sum of the telescoping terms $I_{n+1}-I_n$.
First, using $(6)$, observe that we have
$$\begin{align}
I_{n+1}&=\frac{(-1)^{n+2}16}{\pi\sqrt{2}}\int_0^1 \frac{t^{4n+4}(t^2-1)}{(t^4+1)}dt\\\\
&=\frac{(-1)^{n}16}{\pi\sqrt{2}}\int_0^1t^{4n}(t^2-1)\left(1-\frac{1}{t^4+1}\right)dt\\\\
&=\frac{(-1)^n16}{\pi\sqrt{2}}\int_0^1(t^2-1)t^{4n}dt\\\\
&+I_n\\\\
&=I_n+\frac{(-1)^n16}{\pi\sqrt{2}}\left(\frac{1}{4n+3}-\frac{1}{4n+1}\right) \tag 7
\end{align}$$
Then, using $(7)$ shows that
$$\begin{align}
I_N-I_0&=\sum_{n=0}^{N-1}(I_{n+1}-I_n)\\\\
&=\frac{16}{\pi\sqrt{2}}\sum_{n=0}^{N-1} (-1)^{n}\left(\frac{1}{4n+3}-\frac{1}{4n+1}\right)\\\\
I_N&=\bbox[5px,border:2px solid #C0A000]{I_0+\frac{16}{\pi\sqrt{2}}\sum_{n=0}^{N-1} (-1)^{n}\left(\frac{1}{4n+3}-\frac{1}{4n+1}\right)}
\end{align}$$
where $I_0=\frac{8}{\pi}\int_0^{\pi/4}\sec x\,dx=\frac{4}{\pi}\log(3+2\sqrt{2})$, which agrees with the result obtained by @JackD'aurizio ... as expected!!