Does the vacuum in QFT have nonzero energy or not? I have heard that in QFT, the vacuum has is postulated to have zero four-momentum,
$$P^\mu |\Omega \rangle = 0.$$
However, I also know that it's supposed to have vacuum energy,
$$ \langle \Omega | H | \Omega \rangle = E_0 \neq 0.$$
In textbooks, we patch up the latter equation by subtracting an infinite constant, and are told not to worry about it. In any case, the vacuum has to have zero four-momentum, as a fundamental axiom. 
I am confused since a lot of answers on this site talk about vacuum energy as a real thing that has a definite value. If it's real, then why can we subtract it off to get $P^\mu |\Omega \rangle = 0$? If it's not real, why do we talk about it as if it is?
 A: Indeed, there is a sloppiness in the terminology. One usually fixes the quantum theory to obey
$$ P^\mu \lvert \Omega \rangle = 0$$
since perturbation theory and the LSZ formalism need this to work as intended.
However, this is not the whole story. If we look at the Hamiltonian of a free scalar, it is originally
$$ H = \int \frac{\omega_p}{2} \left(a^\dagger(p) a(p) + a(-p)a^\dagger(-p)\right)\frac{\mathrm{d}^3 p}{(2\pi)^3}$$
after inserting the mode expansion of the fields and using the canonical commutation relations several times. If we formally proceed using the CCR to obtain the $a^\dagger a$ form in which it looks like the (energy-weighted) number operator, we get
$$ H = \int \omega_p a^\dagger(p)a(p)\frac{\mathrm{d}^3 p}{(2\pi)^3} + \frac{1}{2}\int\omega_p\delta_{3\text{D}}(\vec p - \vec p)\mathrm{d}^3 p$$
where the last object is obviously rather badly divergent/ill-defined. One usually proceeds by just discarding that piece since it is "constant", and redefining the Hamiltonian by substracting a constant doesn't change the physics. However, if you apply this to $\lvert 0 \rangle$, you'll find this divergent piece gives exactly the value of the Hamiltonian on the vacuum.
But there's a hack we can try to make sense of this object: First, we note that
$$ \int_U\mathrm{e}^{\mathrm{i}\vec p \cdot \vec x}\mathrm{d}^3 x = (2\pi)^3\delta_{3\text{D}}(\vec p)$$
so the volume of a subset $U\subset \mathrm{R}^3$ is formally given by
$$ V(U) = \int_U\mathrm{d}^3 x = (2\pi)^3\delta_{3\text{D}}(0)$$
and we see the divergence might be due to $\mathbb{R}^3$ just being infinite. In such cases, it is usually a good idea to pass to a density:
$$ \epsilon_\text{vac}(U) := \frac{H \lvert 0 \rangle}{V(U)} = \frac{1}{2}\int \omega_p \frac{\mathrm{d}^3 p}{(2\pi)^3}$$
which is still divergent because $\omega_p = \sqrt{p^2+m^2}$ and the volume element $\mathrm{d}^3p$ is quadratic in $\vert p \vert$ so the integral
$$ \epsilon(\mathbb{R}^3) = \frac{1}{(2\pi)^2}\int_0^\infty\omega_p p^2\mathrm{d}p$$
still diverges. The answer is to regularize the integral with a hard momenutm cutoff $\Lambda$, where now
$$ \epsilon_\text{vac}(\Lambda) = \frac{1}{(2\pi)^2}\int_0^\Lambda\omega_p p^2\mathrm{d}p$$
is finite. Note that we also have the options to classically add a piece $V_0(\Lambda)$ to the Hamiltonian density - it corresponds to the location of the minimum of the classical potential for the field. In the regularized theory and in the absence of gravity, we are free to choose $V_0(\Lambda)$ however we want, in particular as $V_0(\Lambda) = -\epsilon_\text{vac}(\Lambda) + \chi$ for some finite and cutoff-independent $\chi$. Then we can remove the cutoff again and still end up with a finite vacuum energy $\Lambda$. In particular, we may choose $\chi = 0$, yields the correct prescription for the LSZ formalism.
However, in the presence of gravity, the zero of the classical potential is not arbitrary, so for a QFT coupled to gravity, $\chi$ becomes a measureable observable, meaning the expectation value of the energy of the vacuum becomes non-zero. Instead, it becomes an experimental input to the theory.
The above is just a long and explicit way of stating that the "0-point function" of a QFT needs to be renormalized (in Feynman diagram language, we have to manually get rid of the vacuum bubble diagrams, which are all diagrams with no external legs), and the perturbative renormalization parameter we need to fix for that for that is exactly the vacuum energy (density).
