We know that cos(x) is infinitely differentiable and the Lagrange remainder $\rightarrow 0$ for all $x$, so the Taylor series indeed produces the function. We also know that
$\cos^{(4k)}(x)=\cos(x)$ at $x=0$ its $1$
$\cos^{(4k+1)}(x)=-\sin(x)$ at $x=0$ its $0$
$\cos^{(4k+2)}(x)=-\cos(x)$ at $x=0$ its $-1$
$\cos^{(4k+3)}(x)=\sin(x)$ at $x=0$ its $0$
Now the question is how do i get that sum from these informations?
It is the Taylor expansion around $0$ of the cosine function. With $f(x) = \cos(x)$ you just proved that
$\dfrac{d^{2n}}{dx^{2n}}f(x) = (-1)^n$ and $\dfrac{d^{2n+1}}{dx^{2n+1}}f(x) = 0$
Just introduce this in the Taylor expansion definition and you will get your sum.