If the wavefunction is purely real, then <p> = 0:
[tex]\langle p \rangle = \int_{-\infty}^{\infty} \psi^* \left(-i\hbar \frac{d\psi}{dx} \right) \; dx[/tex]
If [itex]\psi^* = \psi[/itex], then this can be written
[tex]\langle p \rangle = -i\hbar \left. \int_{-\infty}^{\infty} \psi \frac{d\psi}{dx} \; dx = -i\hbar \psi(x) \right|_{-\infty}^{\infty} = 0[/tex]
where we have used the boundary condition that the wavefunction must vanish as [itex]x \to \pm \infty[/itex]. On the other hand, if we can write
[tex]\psi(x) = e^{ikx} R(x)[/tex]
where R(x) is real, then
[tex]\langle p \rangle = \int_{-\infty}^{\infty} \psi^* \left(-i\hbar \frac{d\psi}{dx} \right) \; dx = -i\hbar \int_{-\infty}^{\infty} \left( e^{-ikx} R(x) (ik) e^{ikx} R(x) + e^{-ikx} R(x) e^{ikx} \frac{dR}{dx} \right) \; dx = \hbar k \int_{-\infty}^{\infty} R(x)^2 \; dx = \hbar k[/tex]
So, to have a nonzero momentum, the wavefunction needs a phase that varies with x.