Find the $n$ derivative of $y= e^{2x}\sin^2 x$ We have 
\begin{align*}
y&= e^{2x}\sin^2 x\\
&= e^{2x}\left(\frac{1-\cos 2x}{2}\right)\\
&= \frac{e^{2x}}{2} - \frac{e^{2x}\cos 2x}{2}
\end{align*}
Then
\begin{align*}
y^{(n)} &= \left(\frac{e^{2x}}{2}\right)^{(n)} - \left(\frac{e^{2x}\cos 2x}{2}\right)^{(n)}\\
&= 2^{n-1}e^{2x} - \left(\frac{e^{2x}\cos 2x}{2}\right)^{(n)}
\end{align*}
I don't know how to proceed with the rightmost term. So far I've been applying the Leibniz Rule whenever I've had to find the $n$ derivative of a function of the form $f(x)g(x)$, because is clear that either $f(x)$ or $g(x)$ has a derivative a $k$ derivative ($1<k<n$) equal to zero, which simplifies the expression nicely.
But here
$$\frac{e^{2x}\cos 2x}{2}$$
both functions are infinitely differentiable on $\mathbb{R}$ which makes things a bit different.
My only attempt was to write its n derivative in this form
\begin{align*}
&=\frac{1}{2}\sum_{k=0}^n{n \choose k} \big(2^k e^{2x}\big)\bigg(2^{n-k}\cos \left[2x + \frac{\pi(n-k)}{2}\right]\bigg)\\
&=\sum_{k=0}^n {n \choose k} 2^{n-1}e^{2x}\cos \left[2x + \frac{\pi(n-k)}{2}\right]
\end{align*}
So 
\begin{align*}
y^{(n)} &= 2^{n-1}e^{2x} -\sum_{k=0}^n{n \choose k} 2^{n-1}e^{2x}\cos \left[2x + \frac{\pi(n-k)}{2}\right]\\
&= 2^{n-1}e^{2x}\left(1 -\sum_{k=0}^n{n \choose k} \cos \left[2x + \frac{\pi(n-k)}{2}\right]\right)
\end{align*}
But the textbook's answer is
$$2^{n-1}e^{2x}\left(1 -2^{n/2}\cos \left[2x + \frac{\pi n}{4}\right]\right)$$
For some reason I have the feeling that a little of modular arithmetic has to be applied on $\frac{\pi(n-k)}{2}$

You're correct that Leibniz's Rule is a sound way forward.  Note that we have
$$\begin{align}
e^{2x}\sin^2(x)=\frac12 e^{2x}-\frac12 e^{2x}\cos(2x)
\end{align}$$
Then, taking the $n$'th order derivative, we have
$$\begin{align}
\frac{d^n}{dx^n}\left(e^{2x}\sin^2(x)\right)&=\frac{d^n}{dx^n}\left(\frac12 e^{2x}-\frac12 e^{2x}\cos(2x)\right)\\\\
&=2^{n-1}e^{2x}-\frac12 \sum_{k=0}^n\binom{n}{k}\frac{d^{n-k}e^{2x}}{dx^{n-k}}\frac{d^k\cos(2x)}{dx^k}\\\\
&=2^{n-1}e^{2x}\left(1-\sum_{k=0}^n\binom{n}{k}\frac{d^k\cos(2x)}{d(2x)^k}\right)\\\\
\end{align}$$
So, the problem boils down to taking the $k$'th derivative of the cosine function.  But we can express that derivative as $\cos(x+k\pi/2)$.  Hence, we have
$$\begin{align}
\frac{d^n}{dx^n}\left(e^{2x}\sin^2(x)\right)&=2^{n-1}e^{2x}\left(1-\sum_{k=0}^n\binom{n}{k}\cos(x+k\pi/2)\right)\\\\
&=2^{n-1}e^{2x}\left(1-\text{Re}\left(\sum_{k=0}^n\binom{n}{k}e^{i(x+k\pi/2)}\right)\right)\\\\
&=2^{n-1}e^{2x}\left(1-\text{Re}\left(e^{ix}(1+i)^n\right)\right)\\\\
&=2^{n-1}e^{2x}\left(1-\text{Re}\left(2^{n/2}e^{i(x+n\pi/4)}\right)\right)\\\\
&=2^{n-1}e^{2x}\left(1-2^{n/2}\cos(x+n\pi/4)\right)\\\\
\end{align}$$
as was to be shown!
