15$\cdot$40 Let $p$ be an odd prime, and consider the set $\{1,2, \cdots, 2 p\}$. Find the number of subsets $A$ of this set that satisfy the following two conditions:
(1) $A$ has exactly $p$ elements;
(2) The sum of all elements in $A$ is divisible by $p$.

(36th International Mathematical Olympiad, 1995)
[Solution 1] Let $W=\{1,2, \cdots, 2 p\}$,
$$
\begin{array}{l}
U=\{1,2, \cdots, p\}, \\
V=\{p+1, p+2, \cdots, 2 p\} .
\end{array}
$$

Except for the subsets $U$ and $V$, every other $p$-element subset $E$ of $W$ satisfies
$$
E \cap V \neq \emptyset, E \cap U \neq \emptyset \text {. }
$$

If two $p$-element subsets $S$ and $T$ of $W$ that satisfy condition (※) also satisfy the following conditions:
(i) $S \cap V=T \cap V$,
(ii) For appropriate numbering, the elements $S_{1}, S_{2}, \cdots, S_{m}$ of $S \cap U$ and the elements $t_{1}, t_{2}, \cdots, t_{m}$ of $T \cap U$ satisfy the system of congruences
$$
s_{i}-t_{i} \equiv k(\bmod p), i=1,2, \cdots, m .
$$

we agree to classify these two subsets $S$ and $T$ into the same class.
For different subsets in the same class, it is clear that $k \neq 0$, and thus
$$
\sum_{i=1}^{p} s_{i}-\sum_{i=1}^{p} t_{i} \equiv m k \not \equiv 0 \quad(\bmod p) .
$$

For different subsets in the same class, the sum of their respective elements, modulo $p$, has different remainders. Therefore, each class contains exactly $p$ subsets, and only one of them satisfies condition (2) in the problem.

In summary, among the $C_{2 p}$ $p$-element subsets of $W=\{1,2, \cdots, 2 p\}$, except for the two special subsets $U$ and $V$, every $p$ subsets are grouped into one class, and each class has exactly one subset that satisfies condition (2).

Accordingly, the total number of subsets of $W=\{1,2, \cdots, 2 p\}$ that satisfy conditions (1) and (2) is
$$
\frac{1}{p}\left(C_{2 p}-2\right)+2 .
$$
[Solution 2] To examine the subsets of $W=\{1,2, \cdots, 2 p\}$, we construct the following generating function:
$$
\begin{aligned}
g(t, x) & =(t+x)\left(t+x^{2}\right) \cdots\left(t+x^{2 p}\right) \\
& =\sum_{k, m} a_{k, m} t^{k} x^{m}
\end{aligned}
$$

where $a_{k, m}$ is the coefficient of $t^{k} x^{m}$ in the expansion, representing the number of subsets of $W$ that satisfy the following conditions $(\alpha)$ and $(\beta)$:
( $\alpha$ ) The subset contains exactly $2 p-k$ elements;
$(\beta)$ The sum of the elements of the subset is $m$.
Let $\varepsilon=e^{i \frac{2 \pi}{p}}$, and $E=\left\{\varepsilon^{0}, \varepsilon^{1}, \cdots, \varepsilon^{p-1}\right\}$, then we have
$$
\begin{aligned}
& \sum_{t \in E} \sum_{t \in E} g(t, x) \\
= & \sum_{t \in E}\left[\sum_{k, m} a_{k, m} t^{k}\left(\sum_{r \in E} x^{m}\right)\right] \\
= & \sum_{t \in E}\left(\sum_{k, m, p, m} a_{k, m} t^{k}\right) p \\
= & \left(\sum_{p \mid k, p 1 m} a_{k, m}\right) p^{2} .
\end{aligned}
$$

In the calculation, we used the fact:
$$
\sum_{j=0}^{-1} \varepsilon^{j n}=\left\{\begin{array}{l}
0, \text { if } p \nmid n \\
p, \text { if } p \mid n .
\end{array}\right.
$$

Directly using the definition of $g(t, x)$ (without relying on the expansion), we compute the same sum in another way:
$$
\begin{aligned}
& \sum_{t \in E} \sum_{x \in E} g(t, x) \\
= & \sum_{t \in E} \sum_{x \in E}(t+x)\left(t+x^{2}\right) \cdots\left(t+x^{2 p}\right) \\
= & \sum_{t \in E}\left[(t+1)^{2 p}+\sum_{x \in E \backslash: 1}(t+x) \cdots\left(t+x^{2 p}\right)\right] \\
= & \sum_{t \in E}\left[(t+1)^{2 p}+(p-1)\left(t^{p}+1\right)^{2}\right] \\
= & \sum_{t \in E}(t+1)^{2 p}+4 p(p-1) \\
= & \sum_{t \in E}^{1}\left(1+C_{2 p}^{1} t+\cdots+C_{2 p}^{2 p} t^{2 p}\right)+4 p(p-1) \\
= & p\left(1+C_{2 p}^{2}+1\right)+4 p(p-1) \\
= & p\left(C_{2 p}^{p_{p}}+4 p-2\right) .
\end{aligned}
$$

Comparing the results of these two methods (1) and (2), we get
$$
\begin{aligned}
\sum_{p \mid k, p i m} a_{k, m} & =\frac{1}{p}\left(C_{2 p}^{p}+4 p-2\right) \\
& =\frac{1}{p}\left(C_{2 p}^{p}-2\right)+4 .
\end{aligned}
$$

The left side of the above equation, excluding the terms $a_{0, p(p+1)}=a_{2 p .0}=1$, the sum of the remaining terms is the number of subsets that satisfy conditions (1) and (2). Therefore, the number of such subsets is
$$
\sum_{p, m} a_{k, m}=\sum_{p \mid k, p, m} a_{k, m}-2=\frac{1}{p}\left(C_{2 p}^{p}-2\right)+2 .
$$