I want to compute $S=\sum_{k=0}^n\cos(k\theta)\cos^k(\theta)$ for real $\theta$ and positive integer $n$. I tried to solve this using Complex Numbers.
Let $C=\sum\limits_{k=0}^n\sin(k\theta)\cos^k\theta$
$\Rightarrow S+iC=\sum\limits_{k=0}^n\cos^k\theta\left[\cos(k\theta)+i\sin(k\theta)\right]$
$=\sum\limits_{k=0}^ne^{ik\theta}\cos^k(\theta)=\sum\limits_{k=0}^n\left[e^{i\theta}\cos\theta\right]^k$
using geometric progression formula $a=1,r=e^{i\theta}\cos\theta$
$\Rightarrow S+iC=\dfrac{e^{i(n+1)\theta}\cos^{n+1}\theta-1}{e^{i\theta}\cos\theta-1}$
At this point I tried many times to covert this into $a+ib$ form
this way i can let
$S=\sum_{k=0}^n\cos(k\theta)\cos^k(\theta)=a$
by Complex Numbers theorem
But seems like I am just stuck. Can someone help?