Powers of Cosine as a Linear Combination of a Sequence

So I was reading through my Applied Math textbook and came across a proof which they omitted some (I guess what was supposed to be obvious) details but I can't see where they're getting it from.

We're given a sequence defined as follows:

They showed that this forms an orthonormal basis, which I understand how they did it, but I'm not getting how they're going from using the following identity:

to claiming that this demonstrates any power of is a linear combination of the elements from .

How does this identity get used to show that? I'm just really curious.