I've come across the following proof of De Moivre's theorem:
$$ \cos(n\theta) + i\sin(n\theta) = ( \cos\theta + i \sin\theta )^n $$
The proof establishes that:
$ \forall \ \ |s| <1 $,
$$ \sum\limits_{n=0}^\infty \left[ s(\cos(\theta) +i \sin(\theta) )\right]^n = \frac{1}{1-s(\cos(\theta) +i\sin(\theta))} = \sum\limits_{n=0}^\infty s^n(\cos(n\theta) +i\sin(n\theta) ) $$
and then equates coefficients of $s^n$ to arrive at De Moivre's theorem.
What is the justification for equating coefficients in the infinite sums?
Edit: Explaining the above equalities.
The first is derived by geometric series: $$ \sum\limits_{n=0}^\infty \left[ s(\cos(\theta) +i \sin(\theta) )\right]^n = \frac{1}{1-s(\cos(\theta) +i\sin(\theta))} $$
To obtain the second:
$ \begin{align*} &[1-s(\cos(\theta) +i\sin(\theta))] \times \sum\limits_{n=0}^\infty s^n(\cos(n\theta) +i\sin(n\theta) ) \\ &= \sum\limits_{n=0}^\infty [1-s(\cos(\theta) +i\sin(\theta))] \times [s^n(\cos(n\theta) +i\sin(n\theta))] \\ &= \lim_{N \to \infty} \sum\limits_{n=0}^N [ s^n(\cos(n\theta) +i\sin(n\theta)) ] - [s^{n+1}(\cos((n+1)\theta)+i\sin((n+1)\theta))] \\ &= 1 - \lim_{N \to \infty}[s^N(\cos(N\theta) +i\sin(N\theta))] \\ &=1 \\ \end{align*} $
The justification is the identity theorem. If two convergent power series have the same sum in a neighbourhood of $0$, then the coefficients of the two power series are identical.
We even have a stronger theorem: Let
$$f(z) = \sum_{n=0}^\infty a_n z^n$$
be convergent in $D_r(0) = \{z : \lvert z\rvert < r\}$. If there is a sequence $(z_k)$ in $D_r(0)\setminus \{0\}$ with $z_k \to 0$ such that $f(z_k) = 0$ for all $k$, then $a_n = 0$ for all $n$.
We know that the sum of a power series is a continuous function in the open disk (interval) of convergence of the power series, since the convergence is locally uniform. So by our assumptions we have
$$a_0 = f(0) = \lim_{k\to\infty} f(z_k) = 0.$$
If we already know that $a_0 = \dotsc = a_{m-1} = 0$ for some $m \geqslant 1$, then we consider the power series
$$g_m(z) = \sum_{n=0}^\infty a_{n+m} z^n = \sum_{n = m}^\infty a_n z^{n-m},$$
and note that the series converges in $D_r(0)$, and for $z\neq 0$ we have $g(z) = \frac{f(z)}{z^m}$. Thus
$$a_m = g_m(0) = \lim_{k\to\infty} g_m(z_k) = \lim_{k\to\infty} \frac{f(z_k)}{z_k^m} = \lim_{k\to\infty} \frac{0}{z_k^m} = 0.$$
By induction, $a_n = 0$ for all $n$.