In an ideal gas the molecules took up no room and exerted no force on one another. Real molecules do take up room, they push apart once close enough to touch, and a little further out they pull together. Those two corrections are all we put in.
From the volume we subtract what the molecules themselves occupy: the room to move in is V - b, not V. To the pressure we add what the attraction takes away. A molecule heading for the wall is pulled back inwards, so the pressure measured outside comes out lower. The pull goes as the square of the density, which makes it a/V^2.
Putting both in gives (p + a/V^2)(V - b) = RT. It was not derived by counting molecules; two corrections were put into the ideal gas law by hand. And still, from the next scene onwards, a liquid comes out of it.
Pressure up the side, volume across, one curve drawn for each temperature: these are the isotherms. The several curves in the figure are those, the higher ones hotter.
Rewriting on a scale where the critical point is 1 makes a and b vanish from the expression, leaving p = 8T/(3V - 1) - 3/V^2. All that differs from gas to gas is how the scale is set; there is only one shape. This is called the law of corresponding states.
At high temperature, squeezing the volume simply raises the pressure, much as in an ideal gas. Lower the temperature and a stretch appears where the curve goes up and down. Everything to do with liquids and gases sits inside that stretch.
Along the brightened stretch in the figure, raising the volume raises the pressure. Put the other way round: squeezing it lowers the pressure.
That cannot hold. Should some part happen to contract a little, its pressure falls, the surroundings press in, and it contracts further. A part that expands a little expands further still. Nothing returns from a disturbance either way, so the system cannot stay uniform.
The expression itself hands back this stretch without complaint. It is not that the expression is wrong; it is that no uniform state exists along it. What happens instead is that two phases of different density separate and sit side by side.
What pressure do they settle at? While liquid and gas sit side by side the pressure does not move. So the answer is a single level line cutting across the isotherm.
Its height is fixed by the chemical potential being equal in the two phases. Said again in terms of areas, that is the Maxwell construction: the height at which the area above the line equals the area below it.
The two areas in the figure are those. The left end of the line is the liquid, the right end the gas, and between them the two sit together. Along that stretch, changing the volume does not move the pressure at all; only the proportion of liquid to gas changes.
As the temperature rises the level line grows shorter, because the volume on the liquid side and the volume on the gas side draw together.
At one temperature that difference reaches 0 and the line shrinks to a point. That is the critical point, where the T = 1 isotherm touches the horizontal at its inflection. The distinction between liquid and gas ends there.
The dome in the figure is the coexistence curve; inside it the system separates in two, and its top is the critical point. Go round above the critical point and you can pass from liquid to gas without ever crossing a boundary. The difference of density is the order parameter here, and the way it vanishes at the top has the same shape as in the previous piece.