Rotman's Introduction to the Theory of Groups Exercise 1.27
Lemma. (Part 3 here is the most relevant, see the corollary below.) Let $G$ be a finite abelian group. Denote $G=\{g_1,g_2,\ldots,g_n\}$, and let $b$ be the product of all its elements, i.e., $b=g_1\cdot g_2\cdot \ldots\cdot g_n$. Thus:
- $b^2=e$.
- $H=\{x\in G\mid x^2=e\}$ is a subgroup of $G$.
- If there is exactly one an element in $G$ of order $2$, it's $b$.
- If there is more than one element in $G$ of order $2$, $b=e$.
Proof.
- Since every element in $G$ has its inverse, we can also write $G=\{g_1^{-1},g_2^{-1},\ldots,g_n^{-1}\}$. Therefore $b$ is also $$b=g_1\cdot g_2\cdot \ldots \cdot g_n=g_1^{-1}\cdot g_2^{-1}\cdot \ldots \cdot g_n^{-1}.$$ Now, since $G$ is abelian, we can calculate $b^2$ as: $$b^2=g_1 g_2 \ldots g_n g_1^{-1} g_2^{-1} \ldots g_n^{-1}=(g_1 g_1^{-1})( g_2 g_2^{-1})\ldots(g_n g_n^{-1})=e.$$
- It is easy to check that if $a^2=b^2=e$, using the fact that $G$ is abelian, that $(ab)^2=e$ and $a^{-1}=b^{-1}=e$ too. $e^2=e$ too, therefore $H$ is a subgroup of $G$, as it's nonempty and closed under product and inverse.
- If $x\in G$ is the only element of order $2$, it is therefore the only element that is the inverse of itself, so we can write $$b=g_1 g_2\ldots g_n=e\cdot x\cdot \prod_{g\in G \textbf{ s.t. } o(g) > 2} gg^{-1}=x.$$
- For $H\le G$ as before, denote $H=\{x_1,x_2,\ldots,x_r\}$. It is left to the reader to verify that it is a vector space over $\mathbb{F}_2=\{0,1\}$, the field with two elements, with $e=\vec{0}$ and every element being the additive inverse of itself. If $B=(v_1,\ldots ,v_m)$ is a basis for $H$, where $m=\log_{2} {r}$ (where $m\ge3$ from our assumption). There are $2^{m-1}$ elements such that their $i$'th component (in respect to the basis $B$) is $0$, and therefore an even number of elements with their $i$'th component being $1$. Convince yourself that the sum (or any group action, i.e., their sum as vectors) of all elements of $H$ is $\vec{0}$, as it's $0$ in every component. □
Corollary: Wilson's Theorem. Let $p$ be a prime. So $p$ divides $(p-1)!+1$.
Proof. Consider $\mathbb{F}_p^*$, the multiplicative group of the field with $p$ elements. Note that it has $p-1$ elements. Since the polynomial $x^2-1$ has at most $2$ roots over the field $\mathbb{F}_p$, up to two elements $x\in \mathbb{F}_p^*$ might satisfy $x^2=1$. The number $1$ (or $1_{\mathbb{F}_p}$) satisfies this equation, and so does $-1$ (wich, by assuming $p>2$, are different elements). Since $1$ is of order $1$, $-1$ is the only element of order $2$. From part 3 of the lemma we obtain that the product of all elements of $\mathbb{F}_p$ is $b=-1$, therefore we have $$1\cdot 2\cdot \ldots \cdot (p-1)=-1,$$ and, equivalently: $$(p-1)!+1\equiv 0 \mod(p).$$ □
You're not doing anything wrong. Part (i) doesn't apply directly because $(-1)^2 = 1$ but you can still apply the same ideas. Every element $a$ which is not equal to $1$ or $-1$ has an inverse which is distinct from $a$ (think about why this is). So in evaluating $(p - 1)!$, all the terms cancel except $1$ and $-1$.