If \(a^2 ≡ ±1 \bmod p^k\) (where \(p\) is an odd prime), then:
$$\begin{gather} p^k|(a^2- 1) \\ p^k|(a-1)(a+1) \end{gather}$$
If \(p^k\) divides both \(a-1\) and \(a+1\), then it should divide their difference:
$$\begin{gather} p^k|(a+1)-(a-1) \\ p^k|2 \end{gather}$$
This is a contradiction because \(p^k\) is an odd prime. Therefore, \(p^k\) cannot divide both \(a-1\) and \(a+1\), it can only divide one of them.
If \(p^k|a-1\), then \(a^2 ≡ 1 \bmod p^k\). If \(p^k|a+1\), then \(a^2 ≡ -1 \bmod p^k\).