Example 3. (IMO-36-6) Let $p$ be an odd prime, and consider the subsets $A$ of the set $\{1,2, \cdots, 2 p\}$ that satisfy the following two conditions:
(i) $A$ has exactly $p$ elements;
(ii) The sum of all elements in $A$ is divisible by $p$.
Determine the number of such subsets $A$.
Let $S=\{1,2, \cdots, 2 p\}$.
We take $p$-th roots of unity $\xi=e^{i \frac{i x}{p}}$, and then consider the polynomial
$$
\prod_{j=1}^{2 p}\left(x-\xi^{j}\right)=\left(x^{p}-1\right)^{2}=x^{2 p}-2 x^{p}+1 .
$$

Comparing the coefficient of $x^{p}$, we get:
(1) $2=\sum_{\left\{i_{1}, \cdots, i_{p}\right\} \subset S} \xi^{i_{1}+\cdots+i_{p}}=\sum_{j=0}^{p-1} n_{j} \xi^{j}$.
The last step in (1) is grouping terms according to the remainder of $i_{1}+\cdots+i_{p}$ modulo $p$. From (1), we further obtain
(2) $\left(n_{0}-2\right)+\sum_{j=1}^{p-1} n_{j} \xi^{j}=0$.

The irreducible polynomial
$$
f(x)=x^{p-1}+x^{p-2}+\cdots+1
$$

is the minimal polynomial of $\xi$ over the rationals. The polynomial
$$
g(x)=\left(n_{0}-2\right)+\sum_{j=1}^{p-1} n_{j} x^{j}
$$

is also a polynomial that has $\xi$ as a root. Therefore, $f(x) \mid g(x)$. Since these polynomials have the same degree, there exists a constant $\lambda$ such that
$$
g(x)=\lambda f(x) .
$$

This implies
(3) $n_{0}-2=n_{1}=n_{2}=\cdots=n_{p-1}$.
Using the relation $\sum_{j=0}^{p-1} n_{j}=C_{2_{p}}^{p}$, we also get
(4) $\left(n_{0}-2\right)+n_{1}+\cdots+n_{p-1}=C_{2 p}^{p}-2$.
From (3) and (4), we finally obtain
$$
n_{0}=\frac{1}{p}\left(C_{2 p}^{p}-2\right)+2 \text {. }
$$

This is the answer (the number of subsets $A$ that satisfy conditions (i) and (ii)).