Look at what White’s pawn on e5 is actually doing. It attacks d6 and f6. Black’s d-pawn is at home on d7, and if it steps to d6 it is simply taken. That control is the point of putting a pawn on e5 in the first place.
8
7
2
a
b
c
d
e
f
g
h 1 Now imagine the two-square move without any correction. Black plays d7-d5, the pawn sails over d6 without ever stopping there, and White’s pawn watches it go. A pawn that was doing a job for four moves gets walked around by a piece of footwork. That is the loophole, and en passant is the patch.
What the patch says
The capture treats the two-square move as if it had been one square. Your pawn goes to d6 and the black pawn is removed, which is exactly the position you would have reached if Black had played the slow d7-d6 and you had taken it. Nothing more than that. The rule does not give pawns a new power, it takes away a way of dodging one.
That is also why the window is a single move. The two-square move happened on one move, so the compensation lives on one move, and then the position carries on as normal.
Where the two-square move came from
Pawns crawled one square at a time for most of the game’s history. The two-square first move arrived in Europe in the 15th century, in the same wave of changes that turned the queen from a one-square piece into the strongest thing on the board and gave the bishop its long diagonal. All of it was about the same thing: getting the pieces into contact quickly instead of spending fifteen moves shuffling forward. Fast openings were the whole design goal.
En passant is the small print on that reform. Speed up the pawn, but do not let the extra speed change who controls what.
The rule is narrower than people assume
It patches one thing only. A pawn cannot capture sideways in general, a pawn cannot take a piece that has just moved two squares, and a rook standing next to the arriving pawn gets nothing at all. Only a pawn, only against a pawn, only against the two-square jump, only immediately. If you have ever felt that en passant is an exception with no logic behind it, that shape is the logic: it is exactly as wide as the hole it fills, and not a square wider.
For the four conditions written out, see the en passant rules, or go and take a few pawns in passing in the en passant puzzle set.