The question is:
If $p$ is an odd prime, find the number of subsets of size exactly $p$ of $S = \{1,2, \dots, 2p\}$, the sum of whose elements is divisible by $p$.
On the actual test, very few students solved it. That to me is a bit surprising, but seems like the problem setters predicted well! P6 is supposed to be the hardest problem and performance of the students does indicate that to be true, and they were right in selecting this problem as P6.
.
.
.
.
.
This seems like a textbook generating functions question, hence my surprise. Generating functions were part of the IMO toolkit in 1995. Anyway. below is one way to use generating functions.
Solution:
Consider the function
$$f(t,x) = (t + x) (t + x^2) \dots (t + x^{2p})$$
If you look at this as a polynomial in $t$, then the coefficient of $t^{2p - m}$ is a polynomial in $x$, whose $N^{th}$ coefficient (i.e coefficient of $x^N$) tells us how many $m$ elements subsets of $S$ sum to $N$.
Thus we need to look at the polynomial in $x$ which is the coefficient of $t^p$ in $f(t,x)$ and then extract the sum of coefficients of $x^0, x^{p}, x^{2p}, \dots $ from that.
For sake of simplicity let us find the polynomial in $x$ that is the sum of coefficients of $t^{0}, t^{p}, t^{2p}$ and then adjust accordingly.
Now the sum of coefficients of $t^{0}, t^{p}, t^{2p}$ is
$$P(x) = \frac{1}{p} \sum_{n = 0}^{p-1} f(w^n, x)$$
where $w$ is a primitive $p^{th}$ root of unity.
The sum of coefficients of $x^{kp}$ in $P(x)$ computes the number of subsets of $S$ whose sum and size are both divisible by $p$. The answer for the problem as asked will be $2$ less than this number (the empty set and $S$ itself).
Now the sum of coefficients of $x^{kp}$ in $P(x)$ is again, using the primitive $p^{th}$ root of unity:
$$\frac{1}{p} \sum_{m=0}^{p-1} P(w^m)$$
$$ = \frac{1}{p^2} \sum_{m=0}^{p-1} \sum_{n=0}^{p-1} f(w^n, w^m)$$
Now we have that $$f(t,1) =(t+1)^{2p}$$ and for $0 < m \leq p-1$, $$f(t, w^m) = ((-t)^p - 1)^2 = t^{2p} +2t^p + 1$$
Because $t^p - 1 = (t - 1)(t-w)\dots (t - w^{p-1})$ and so $(-t)^p - 1 = (-1)^p (t +1) (t+w) \dots (t + w^{p-1})$. We also have $w^{p+k} = w^k$.
Thus $f(w^n, w^m) = 4$ for $m \neq 0$.
So, by splitting $m=0$ and $m > 0$, we get
$$ \frac{1}{p^2} \sum_{m=0}^{p-1} \sum_{n=0}^{p-1} f(w^n, w^m)$$
$$ = \frac{1}{p^2} \sum_{n=0}^{p-1} (1 + w^n)^{2p} + \frac{p-1}{p^2} \sum_{n=0}^{p-1} 4$$
Now $$\frac{1}{p} \sum_{n=0}^{p-1} (w^n + 1)^{2p}$$
is again, just the sum of coefficients of $x^{kp}$ in $(1 + x)^{2p}$, which is $2 + \binom{2p}{p}$
Thus we get
$$\frac{2 +\binom{2p}{p}}{p} + \frac{4p - 4}{p} $$
$$ = \frac{\binom{2p}{p} - 2}{p} + 4$$
Thus after subtracting $2$ to get what the problem seeks, we get the final answer as
$$\boxed{\frac{\binom{2p}{p} - 2}{p} + 2}$$