J. D. van der Waals corrected the ideal gas equation for the two assumptions kinetic theory makes that no real gas actually satisfies -- negligible molecular volume and zero intermolecular attraction -- by adding a pressure correction and a volume correction.
Pressure correction. A molecule about to strike the container wall is pulled back very slightly by the attraction of its neighbours (a molecule surrounded on all sides instead feels balanced, cancelling attraction), so it hits the wall a little less forcefully than it would with no attraction at all -- the measured pressure of a real gas is therefore somewhat lower than the true "ideal" pressure. This attractive effect scales with the square of the gas density, giving a correction term V2an2 (where a is the first van der Waals constant, larger for more strongly attracting molecules), so Pideal=P+V2an2.
Volume correction. Because real molecules occupy actual space and cannot overlap, the volume genuinely available for them to move in is less than the container volume V. Modelling molecules as hard spheres of radius r, the excluded volume around a colliding pair works out to 8Vm (eight times a single molecule's own volume Vm), giving an excluded volume per molecule of 4Vm; for n moles this totals nb, where b=4Vm is the second van der Waals constant (larger for physically bigger molecules). The corrected, genuinely available volume is Videal=V−nb.
The van der Waals equation. Substituting both corrections into PV=nRT gives
(P+V2an2)(V−nb)=nRT …