n = 10;
Plot[1 + Sum[Cos[k t], {k, 1, n}], {t, -2 π, 2  π}, 
      PlotRange -> {-2, n + 1}]

Plot[
      (1/2) +  Sin[(2  n + 1) t/2]/(2  Sin[t/2]), {t, -2 π, 
        2  π}, PlotRange -> {-2, n + 1}]