How to solve back-rank mate puzzles
The weakness is created by good habits. Castling tucks the king behind three pawns, and those pawns are rarely moved. Then the rooks leave the back rank, and the king has no air. One open file is all the attacker needs.
Many back-rank puzzles are not a single move. The defender often has a rook or queen guarding the back rank, so the solution starts by removing it: a capture, a deflection, or a sacrifice that the guard has to take. Once the guard is gone, the mate follows.
To spot it, check whether the enemy king can step forward. If its pawns are all on their starting squares and no piece covers the back rank twice, look at every check you can give on that rank. In your own games, a pawn move such as h3 or h6 at a quiet moment gives your king the escape square that prevents it.