It is the same $f(x):=x^2\sum\limits_{k=0}^\infty(\cos x)^k$ than $g(x):=\sum\limits_{k=0}^\infty x^2(\cos x)^k$? It is the same $f(x):=x^2\sum\limits_{k=0}^\infty(\cos x)^k$ than $g(x):=\sum\limits_{k=0}^\infty x^2(\cos x)^k$? 
It seems that $f(0)$ is not defined because $\sum_{k=0}^\infty 1^k=\infty$, however $g(0)=0$! There is something wrong with this reasoning or this is a case where normal arithmetic fails with series?
 A: There's nothing particularly special about $\sum_{k=0}^\infty(\cos x)^k$ per se, this is more to do with if you accept the following equation or not:
$$
0+0+0+\dots =0(1+1+1+\dots)
$$
Yes, strictly speaking the value on the right hand side is not defined since $1+1+\dots$ diverges, but sometimes it is convenient to set it to be $0$. This convention is used many places in analysis, e.g. measure theory.
A: They are same. The key is to remember that:
\begin{align*}
\sum_{k=1}^{\infty}a_k = \lim_{n\rightarrow\infty}\sum_{k=1}^{n}a_k
\end{align*}
If you consider the sequence:
\begin{align*}
(a_n) = \{0^2\cdot1, 0^2\cdot(1+1), 0^2\cdot(1+1+1), \cdots\} = \{0, 0, 0, \cdots\}
\end{align*}
You will see that for each $n\in \mathbb{N}, a_n = x^2\sum_{k=0}^{n}\cos^k(x)$, when $x = 0$. This shows that:
\begin{align*}
f(0) = \lim_{n\rightarrow\infty}x^2\sum_{k=1}^{n}\cos^k(x) = \lim_{n\rightarrow\infty}a_n = \lim_{n\rightarrow\infty}0 = 0
\end{align*}
A: They are almost the same.  They are the same except when $x=0$.  
If $x=0$ then all terms in $g(x)$ are zero, so $g(0)$ exists and equals $0$.  But the definition of $f(0)$ says:
$$
f(0) := 0^2\;\sum_{k=0}^\infty (\cos 0)^k
$$
which is zero times a divergent series.  So $f(0)$ is undefined.
Now, it is true that $f(x)$ has a removable discontinuity at zero.  So for most purposes setting $f(0)=0$ is what you want anyway.
added
Let me put here another example.  Define
$$
h(x) := \big(1-\cos x\big)\;\sum_{k=0}^\infty (\cos x)^k
$$
Now for $-\pi < x < \pi$ except $x=0$ we have $h(x) = 1$, yet for $x=0$ we have the same undefined
$$
h(0) := 0\;\sum_{k=0}^\infty (\cos 0)^k
$$
Now the natural value is $h(0)=1$.  The difference between $f(0)$ and $h(0)$ is an illustration of the indeterminate form $0 \cdot \infty$.
A: Yes they are the same. As the sum is only over the parameter $k$ you can treat the $x^2$ as a constant (it doesn't change with $k$) and factorize or expand it as you have done.
