I am studying number representations in base $b$, and in order to understand the method of "casting out 9s", "casting out 11s", and "casting out 99s" for a generic base, the following observations have been made: $$ \sum_{k=0}^p a_k \cdot b^k \equiv \sum_{k=0}^p a_k \mbox{ (mod }b-1), $$ $$ \sum_{k=0}^p a_k \cdot b^k \equiv \sum_{k=0}^p (-1)^k \cdot a_k \mbox{ (mod }b+1), $$ and $$ \sum_{k=0}^p a_k \cdot b^k \equiv \sum_{k=0}^{p/2} a_{2k+1}a_{2k} \mbox{ (mod }b^2-1), $$
(later edited) where the terms on the right-side $a_{2k+1}a_{2k}$ are just 2-digits numbers, not products, which I pointed out as "$\cdot$".
I can easily derive the first two formulas, but I am stuck with the third one. Of course, I know that $b^2-1=(b+1)(b-1)$, but I may be missing some properties properties of modular arithmetic. Can you help me?
EDIT After checking the 'casting out 99s' method, I realized that $a_{2k+1}a_{2k}$ is not the product of the two coefficients, but the number obtained by juxtaposing them. So we just sum pairs of digits. But anyway, why is that the case?