How show that for a free EM field, the energy of each mode is conserved in time? For a free electromagnetic field, since different modes do not talk to each other, one would expect that the energy stored in each mode is conserved (or constant) in time. But the energy stored in a typical plane wave mode $$\vec{E}(\vec r,t)=\hat{e}_s\widetilde{E}_{0s}(\vec k) e^{i(\vec k\cdot\vec r-\omega t)}, ~~\widetilde{E}_{0s}=E_{0s}e^{i\delta}$$ (where $\hat{e}_s$ is the polarization vector of the plane wave mode $(\vec k, s)$) turns out to be equal to $$\frac{1}{2}\epsilon_0\vec E\cdot\vec E=\frac{1}{2}\epsilon_0{E}^2_{0s}(\vec k)~e^{2i(\vec k\cdot\vec r-\omega t+\delta)}$$ which depends on time unless averaged over a cycle. But averaging over time will make anything time-independent. So how do we explain that for a free EM field, the energy of each mode is conserved in time?
ADDITIONS AFTER THE ANSWERS
According to the answers below, since the physical electric field is real, we must either use $$\vec{E}(\vec r,t)=\hat{e}_s\widetilde{E}_{0s}(\vec k) e^{i(\vec k\cdot\vec r-\omega t)}+{\rm c.c.}$$ where c.c. means complex conjugate or take the real part to write $\vec E$ as:
$$\vec{E}(\vec r,t)=\hat{e}_sE_{0s}\cos(\vec k\cdot\vec r-\omega t+\delta)$$ where $E_{0s}$ is real and for simplicity assumed $\hat{e}_s$ is also real. The corresponding magnetic field is given by $$\vec{B}(\vec r,t)=(\hat{k}\times\hat{e}_s)B_{0s}\cos(\vec k\cdot\vec r-\omega t+\delta), ~~ B_{0s}=\frac{E_{0s}}{c}$$
Therefore, the total energy stored in the mode characterized by $(\vec k, s)$, we see that $$\mathcal{E}=\int d^3r\left[\frac{\epsilon_0}{2}E^2_{0s}+\frac{1}{2\mu_0}\frac{E^2_{0s}}{c^2}\right]\cos^2(\vec k\cdot\vec r-\omega t+\delta)\\
=\epsilon_0E^2_{0s}\int d^3r\cos^2(\vec k\cdot\vec r-\omega t+\delta)$$ which is still time-dependent (and also divergent).
 A: The electric field is real vector, not complex. The imaginary part is added for convenience and makes no problems when operation that you are doing with it are linear. In energy formula, you are however taking a square, so you should use only the real part of electric intensity:
$$\frac{1}{2}\epsilon_0\vec E\cdot\vec E=\frac{1}{2}\epsilon_0\widetilde{E}^2_{0s}(\vec k)~\cos^2{(\vec k\cdot\vec r-\omega t)}.$$
Averaging over a wavelength then rids you of time dependence.
A: There are 3 issues in your calculation of the energy of a wave mode:

*

*The electric field needs to be real-valued instead of complex-valued.
You can assure this by adding the complex conjugate.
$$\begin{align}
  \vec{E}(\vec r,t)&=\hat{e}_s\tilde{E}_{0s}(\vec k) e^{i(\vec k\cdot\vec r-\omega t)} \\
                   &+\hat{e}_s^*\tilde{E}_{0s}^*(\vec k) e^{-i(\vec k\cdot\vec r-\omega t)}
  \end{align}$$

*$\frac{1}{2}\epsilon_0\vec E(\vec r,t)\cdot\vec E(\vec r,t)$
is not the energy, but the energy density (i.e. energy per volume).
You get the energy as the volume integral:
$$\mathcal E=\int \frac{1}{2}\epsilon_0\vec E(\vec r,t)\cdot\vec E(\vec r,t)\ d^3r$$

*Besides the electric field energy, you also need to consider the magnetic field energy:
$$\mathcal E=\int \frac{1}{2}\epsilon_0\vec E(\vec r,t)\cdot\vec E(\vec r,t)\ d^3r
   +\int \frac{1}{2\mu_0}\vec B(\vec r,t)\cdot\vec B(\vec r,t)\ d^3r$$

Edit (replying to comments and amended question):
Doing this calculation you arrive at
$$\mathcal{E}=\epsilon_0E^2_{0s}\int d^3r\cos^2(\vec k\cdot\vec r-\omega t+\delta)$$
For evaluating this integral we use a large but finite volume
(let us say a cube with a large edge length $L$ which is much larger
than any wavelength of the EM wave).
$$\mathcal{E}=\epsilon_0E^2_{0s}\int_{-L/2}^{+L/2}dx\int_{-L/2}^{+L/2}dy\int_{-L/2}^{+L/2}dz
 \cos^2(\vec k\cdot\vec r-\omega t+\delta)$$
Now we use the fact that $\cos^2(\vec k\cdot\vec r-\omega t+\delta)$
averaged over $x,y,z$ across many wavelengths is simply
$\frac{1}{2}$, independent of $\omega t$ and $\delta$.
(See also this question.)
$$\mathcal{E}=\frac{1}{2}\epsilon_0E^2_{0s}L^3 = \frac{1}{2}\epsilon_0E^2_{0s}V$$
We cannot extend the volume $V$ over the entire space,
because for $V=\infty$ we would also get $\mathcal{E}=\infty$.
Therefore we need to keep the $V$ in the final formula.
