I recently came across this beautiful proof by Erdős that uses generating functions in a unique way:
Let $S = \{a_1, \cdots, a_n \}$ be a finite set of positive integers such that no two subsets of $S$ have the same sum. Prove that $$\sum_{i=1}^n \frac{1}{a_i} < 2.$$
Question: Are there any more examples of surprising or unexpected proofs using generating functions that this community is aware of?
(Please refrain from posting answers that are widely known such as change making, closed form for Fibonacci, etc.)
The proof of the above theorem:
Proof: Suppose $0< x < 1$. We have $$\prod_{i=1}^n (1 + x^{a_i}) < \sum_{i = 0}^{\infty} x^i = \frac{1}{1-x}.$$ Thus, $$\begin{align*} \sum_{i=1}^n \log(1+x^{a_i}) &< - \log(1-x) \\ \sum_{i=1}^n \int_0^1 \frac{\log(1+x^{a_i})}{x} \ dx &< - \int_0^1 \frac{\log(1-x)}x \ dx . \end{align*}$$ Putting $x^{a_i} = y$, we obtain $$\begin{align*} \sum_{i=1}^{n} \frac{1}{a_i} \int_0^1 \frac{\log(1+y)}{y} \ dy < - \int_0^1 \frac{\log(1-x)}{x} \ dx \end{align*}$$ i.e., $$\sum_{i=1}^n \frac{1}{a_i} \left( \frac{\pi^2}{12} \right) < \frac{\pi^2}6.$$ Thus, $\sum_{i=1}^n \frac{1}{a_i} < 2$ and the theorem is proved.

I remember this problem from Stein & Shakarchi's Complex Analysis.
In the hint of this problem, the terms $\frac{z^a}{1-z^d}$ represents the ordinary generating function for the characteristic function of the arithmetic progression $S=\{a, a+d, a+2d, \ldots\}$.
Another good example is this problem, and the answer by @barto