In a class of nonlinear optics, the professor said that the E fields are always real and that for an EM wave we write $\vec{E}(\vec{r},t) = \vec{E}(\vec{r})\cdot e^{-i\omega t } + c.c.$ to ensure the realness of the field.
In Boyd's Nonlinear Optics text, Chapter 2, there is a passage of deriving the field equations in a nonlinear medium. He uses Maxwell's equations for macroscopic medium with no free charge or free current to obtain the following equation $$-\nabla^2\vec{E}(\vec{r},t) +\frac{\epsilon^{(1)}_r}{c^2}\frac{\partial^2 \vec{E}(\vec{r},t)}{\partial t^2}=-\frac{1}{\epsilon_0 c^2}\frac{\partial^2 \vec{P}^{NL}(\vec{r},t)}{\partial t^2},$$ where $\vec{P}^{NL}$ is the nonlinear polarization.
We then substitute a particular frequency component of E field given by the following $$\vec{E}_n(\vec{r},t) = \vec{E}_n(\vec{r})\cdot e^{-i\omega_n t } + c.c.$$ The resulting equation is the following: $$\nabla^2\vec{E}_n(\vec{r}) +\frac{\epsilon^{(1)}_r\omega^2_n}{c^2} \vec{E}(\vec{r}) =-\frac{1}{\epsilon_0 c^2} \vec{P}^{NL}_n(\vec{r}).$$
However, if I literally substitute in the expression of $E_n(r,t)=E_n(r)e^{-i\omega t} + c.c.$, I will not be able to factor out the exponential ($e^{-i\omega t}$) and cancel them out in both sides of the equations, because there are the complex conjugates with terms $e^{i\omega t}$.
What am I misunderstanding here?
{Some additional thoughts: As I was typing, I realized one thing which may or may not be the correct explanation. If I group terms with $e^{-i\omega t}$ and $e^{i\omega t}$ when I plug in the specific frequency component of E field into the wave equation for E fields. I will get
(something)$\times e^{-i \omega t} + $ (something else)$\times e^{i\omega t}=0$
Because $ e^{-i \omega t}$ and $e^{ i \omega t}$ are orthogonal functions, their coefficients should be identically zero to make their sum zero. (However, as I am writing this... I cannot convince myself that they are orthogonal because if I multiply them and integrate... I don't get zero unless the integration interval is zero)}