This is a question that comes in two parts.
First, prove that if $a^{2^{n-1}}\not\equiv1 \pmod {2^{n}}$, then $a$ is even.
Second, prove that for any odd prime $p$, if $a$ is odd and $a^{2^{n-1}(p-1)}\not\equiv1 \pmod 2^{n}p$, then $p|a$.
For the first one, I realized I can try proving the contrapositive, and then use induction. Then what should I do next? Fermat's Little Theorem?
For the second one, can you split the modulus into $2^{n}$ and $p$? I think this might be a good method. Answers and ideas are welcome!