I have to make a problem very similair to the attached example, I tried working it through but I am stuck when the integral for $a_n$ is solved, I dont get where the highlighted +1 comes from. If I fill in the boundaries all $w$ cancel and I don't have this +1
Thanks in advance :)

It comes from evaluating the integral at $t = 0$
\begin{eqnarray} a_n &=& \frac{\omega E}{2\pi}\left[-\frac{\cos(1 + n)\omega t}{(1 + n)\omega} -\frac{\cos(1 - n)\omega t}{(1 - n)\omega}\right]_0^{\pi/\omega}\\ &=& \frac{E}{2\pi}\left[ -\frac{\cos(1 + n)\pi}{(1 + n)} +\color{red}{\frac{\cos(1 + n)0}{(1 + n)}}-\frac{\cos(1 - n)\pi}{(1 - n)} +\color{red}{\frac{\cos(1 - n)0}{(1 - n)}}\right] \\ &=& \frac{E}{2\pi}\left[ -\frac{\cos(1 + n)\pi + \color{red}{1}}{(1 + n)} -\frac{\cos(1 - n)\pi+\color{red}{1}}{(1 - n)} \right] \end{eqnarray}