Impulse operator on real wave function The impulse operator in quantum mechanics is given by
\begin{align}
\hat{p} = \frac{\hbar}{i}\nabla
\end{align}
As a Hermitian operator, the expected value of this operator $\langle{p}\rangle = \langle \psi|\hat{p}\psi\rangle$ should be real. However, for a real wave function $\psi(\vec
{r})\in \mathbb{R}$ (a valid solution to the Schrödinger equation) the resulting integral is imaginary:
\begin{align}
\langle{p}\rangle = \frac{\hbar}{i}\int d^3r \cdot \psi \nabla \psi
\end{align}
Is there an error in my thinking or is it impossible to calculate the expected value that way? An alternative approach would be to use the Fourier transform.
 A: The possibility that is not accounted for in the question is that the integral may be zero. In fact, it can be shown that a wave function corresponding to a stationary state can always be chosen real, and the momentum of a stationary state is definitely zero.
Another insight may come from considering wave function
$$\phi_+(x) = \psi_k(x) + \psi_{-k}(x) = e^{ikx} + e^{-ikx} = 2\cos(kx).$$
The average momentum in this state is zero, as it is a sum of two states with opposite momenta, $\pm\hbar k$.
To conclude: your formula for the average momentum is correct, since it is obtained from general rule. And, since it would give an unphysical imaginary value for a real wave function, it means that all such wave functions correspond to states with zero momentum.
A: Just to add to Vadim's answer: The integral
$$\int_{-\infty}^{\infty} \psi \partial_x \psi dx= \frac12 \int_{-\infty}^{\infty} \partial_x( \psi^2) dx = [\psi^2]_{-\infty}^{\infty}=0
$$
fo all wavefunctions that vanish at infinity.
A: If your wavefunction $\psi$ is real, as is the case when you are dealing with a  solution to the time-independent Schrodinger equation, then indeed the expectation value is automatically $0$ since the expectation value must be real and the integral $-i/\hbar\int dx \psi^* (\nabla)\psi$ is necessarily complex unless it is $0$.
If the wavefunction is complex, then one cannot say: the expectation can be $0$ or not.  For instance, the combination of h.o. wavefunctions
\begin{align}
\psi(x)=\alpha \psi_n(x)+i\beta\psi_{n+1}(x)\, ,\qquad 
\alpha^2+\beta^2=1\, ,\quad \alpha,\beta\in\mathbb{R}
\end{align}
will have non-zero $\langle p\rangle$.  However,
\begin{align}
\psi(x)=\alpha \psi_n(x)+i\beta\psi_{n+2}(x)\, ,\qquad 
\alpha^2+\beta^2=1\, ,\quad \alpha,\beta\in\mathbb{R}
\end{align}
will have $\langle p\rangle=0$ even if it is a complex combination.
