How to calculate all the four solutions to $(p+5)(p-1) \equiv 0 \pmod {16}$? This is a kind of a plain question, but I just can't get something.
For the congruence and a prime number $p$: $(p+5)(p-1) \equiv 0\pmod {16}$.
How come that the in addition to the solutions 
$$\begin{align*}
p &\equiv 11\pmod{16}\\
p &\equiv 1\pmod {16}
\end{align*}$$ 
we also have
$$\begin{align*}
p &\equiv 9\pmod {16}\\
 p &\equiv 3\pmod {16}\ ?
\end{align*}$$
Where do the last two come from? It is always 4 solutions? I can see that they are satisfy  the equation, but how can I calculate them?
Thanks

First note that $p$ has to be odd. Else, $(p+5)$ and $(p-1)$ are both odd.
Let $p = 2k+1$. Then we need $16 \vert (2k+6)(2k)$ i.e. $4 \vert k(k+3)$.
Since $k$ and $k+3$ are of opposite parity, we need $4|k$ or $4|(k+3)$.
Hence, $k = 4m$ or $k = 4m+1$. This gives us $ p = 2(4m) + 1$ or $p = 2(4m+1)+1$.
Hence, we get that $$p = 8m +1 \text{ or }8m+3$$ which is what your claim is as well.
EDIT
You have obtained the first two solutions i.e. $p = 16m+1$ and $p=16m + 11$ by looking at the cases $16 \vert (p-1)$ (or) $16 \vert (p+5)$ respectively.
However, note that you are leaving out the following possibilities.


*

*$2 \vert (p+5)$ and $8 \vert (p-1)$. This combination also implies $16 \vert (p+5)(p-1)$

*$4 \vert (p+5)$ and $4 \vert (p-1)$. This combination also implies $16 \vert (p+5)(p-1)$

*$8 \vert (p+5)$ and $2 \vert (p-1)$. This combination also implies $16 \vert (p+5)(p-1)$


Out of the above possibilities, the second one can be ruled out since $4 \vert (p+5)$ and $4 \vert (p-1)$, then $4 \vert ((p+5)-(p-1))$ i.e. $4 \vert 6$ which is not possible.
The first possibility gives us $ p = 8m+1$ while the second possibility gives us $p = 8m +3$.
Combining this with your answer, we get that $$p = 8m +1 \text{ or }8m+3$$
In general, when you want to analyze $a \vert bc$, you need to write $a = d_1 d_2$, where $d_1,d_2 \in \mathbb{Z}$ and then look at the cases $d_1 \vert a$ and $d_2 \vert b$.
