SUGERENCIA:
$$\sum_{1\le k\le n}\left(\cos k\theta+\sin k\theta\right)=\sum_{1\le k\le n}e^{i k\theta}=e^{i\theta}\cdot\frac{e^{\theta}-1}
{e^{i\theta}-1}$$
Diferenciar wrt $\theta$ y equiparar la real y la imaginaria
$$\text{On differentiation, the left hand becomes }\sum_{1\le k\le n}k\left(-\sin k\theta+i\cos k\theta\right)$$
Alternativamente, si $S=\sum_{1\le k\le n}k\cdot a^k=a+2\cdot a^2+\cdots+(n-1)\cdot a^{n-1}+n\cdot a^n$
$a\cdot S=a^2+2\cdot a^3+\cdots+(n-1)\cdot a^n+n\cdot a^{n+1}$
$$\text{On subtraction,}(a-1)S=n\cdot a^{n+1}-(a+a^2+\cdots+a^{n-1}+a^n)=n\cdot a^{n+1}-\frac{a(a^n-1)}{a-1}$$
$$\implies S=\sum_{1\le k\le n}k\cdot a^k=\frac{n\cdot a^{n+1}}{a-1}-\frac{a(a^n-1)}{(a-1)^2}$$
Poner a $a=e^{i\theta},$
$$S=\sum_{1\le k\le n}k\cdot e^{ik\theta}=\frac{n\cdot e^{i(n+1)\theta}}{e^{i\theta}-1}-\frac{e^{i\theta}(e^{in\theta}-1)}{(e^{i\theta}-1)^2}$$ (La derivada método debe traernos aquí,también)
$$S=\frac{ne^{i(n+1)\theta}}{e^{i\frac\theta2}(e^{i\frac\theta2}-e^{-i\frac\theta2})}-\frac{e^{i\theta}(e^{in\theta}-1)}{\{e^{i\frac\theta2}(e^{i\frac\theta2}-e^{-i\frac\theta2})\}^2}$$
Como $e^{ix}-e^{-ix}=2i\sin x,$ $$S=\frac{ne^{i\frac{(2n+1)\theta}2}}{(e^{i\frac\theta2}-e^{-i\frac\theta2})}-\frac{(e^{in\theta}-1)}{(e^{i\frac\theta2}-e^{-i\frac\theta2})^2}$$
$$S=\frac{n\left(\cos\frac{(2n+1)\theta}2+i\sin\frac{(2n+1)\theta}2\right)}{2i\sin\frac\theta2}-\frac{(\cos n\theta+i\sin n\theta-1)}{(2i\sin\frac\theta2)^2}$$
$$=\frac{\cos n\theta-1}{4\sin^2\frac\theta2}+\frac{n\sin \frac{(2n+1)\theta}2}{2\sin\frac\theta2}+i\left(\frac{\sin n\theta}{4\sin^2\frac\theta2}-\frac{n(\cos\frac{(2n+1)\theta}2}{2\sin\frac\theta2}\right)$$
De nuevo, $$S=\sum_{1\le k\le n}k\cdot e^{ik\theta}=\sum_{1\le k\le n}k(\cos k\theta+i\sin k\theta)=\sum_{1\le k\le n}k\cdot\cos k\theta+i\sum_{1\le k\le n}k\cdot\sin k\theta$$
Ahora, equiparar la real y la imaginaria