This is basically the same argument as the probability approach used in the original solution, but somewhat simplified and hopefully easier to understand.
To help avoid special cases for the $n_i$, let's start by appending zeroes to the list $a_1,\ldots,a_N,0,\ldots,0$ so it gets length $2^k-1\ge N$. We will make a solution to this consisting of $1=n_0<\cdots<n_{k-1}<n_k=2^k$. To solve the original problem, depending on whether $n_{k-1}>N$ or not, replace $n_k$ with $n_k=N+1$, or remove $n_k$ and replace $n_{k-1}$ with $n_{k-1}=N+1$.
We consider all combinations of $n_1\in\{2,3\}$, $n_2\in\{4,5,6,7\}$, etc.: i.e., $n_i\in\{2^i,\ldots,2^{i+1}-1\}$ for $i=1,\ldots,k-1$. This gives us lots of options for the sequence $n_i$.
Next, we average over all combinations of $n_i$. The average value of $n_i$ is $(3\cdot2^i-1)/2<3\cdot2^{i-1}$ while the average value of $a_{n_i}$ is $(a_{2^i}+\cdots a_{2^{i+1}-1})/2^i$. Since $n_i$ and $n_{i+1}$ are chosen independently, this makes the average value of the term $a_{n_i}n_{i+1}$
$$
\text{E}[a_{n_i}n_{i+1}]
=\text{E}[a_{n_i}]\cdot\text{E}[n_{i+1}]<3\cdot(a_{2^i}+\cdots+a_{2^{i+1}-1})
$$
which also holds for the term $i=k-1$ as $n_k=2^k<3\cdot 2^{k-1}$.
Adding all the $a_{n_i}n_{i+1}$ terms together then yields
$$
\text{E}[a_{n_0}n_1+\cdots+a_{n_{k-1}}n_k]
<3\cdot(a_1+\cdots+a_{2^{k}-1}).
$$
Since the bound is true for the average, it must be true for at least one of the sequences.