Put a white pawn on e4 and black pawns on d5 and e5, and one of the two black pawns is in danger.
h 1 exd5 wins a pawn. The pawn on e5 is untouchable, and it also blocks the e4 pawn from moving at all. That is the whole rule: pawns move straight and take diagonally, one square, forwards only.
It sounds trivial written down. In practice it is the rule beginners break most often, because every other piece takes exactly where it goes. A rook takes along its line, a knight takes at the end of its L, a bishop on the diagonal it travels. The pawn is the odd one out, and it cannot capture forward no matter how tempting the piece in front of it looks.
What a pawn is actually attacking
Two squares, always: the ones diagonally ahead. A white pawn on d4 attacks c5 and e5. A black pawn on f5 attacks e4 and g4. A pawn on the a-file or the h-file attacks only one square, because the other one falls off the board.
This is worth saying out loud when you check whether a square is safe, because pawns are the cheapest attackers on the board and beginners look straight past them. If a knight can be kicked by a pawn, the knight has to move, and a knight is worth three pawns.
En passant, the one exception
A pawn that has just moved two squares can be captured as if it had moved one. White has a pawn on e5, Black plays f7-f5 shooting past it, and White may answer exf6, taking the pawn that ended up on f5 and landing on f6.
h 1 Two conditions and both are strict. It must be the immediate reply, and only a pawn can do it. There are pages on what en passant is and on whether it is compulsory, and a set of en passant puzzles if you want to see it in real positions.
Notice that even here the pawn ends up on a diagonal square. There is no move in chess where a pawn captures something on the square directly in front of it.
Why the diagonal capture builds everything else
Because pawns take diagonally, they defend each other diagonally, and a line of pawns like c4, d5, e6 defends itself all the way up: only the base of the chain is loose. That is a pawn chain, and attacking one properly means hitting the base, not the head. Two pawns on the same file cannot defend each other at all, which is why doubled pawns are usually a small weakness.
And one pawn attacking two pieces is a fork, exactly like a knight’s. Pushing d5 when there is a knight on c6 and a bishop on e6 wins a piece for a pawn, and it happens in beginner games every day.