This retaining wall is leaning because there is no bracing to hold it back in the grade behind it. Water pressure, due to missing or insufficiently sized drainage pipes, and poorly graded areas can cause the wall to tip. Poorly compacted gravel and backfill during construction can cause leaning as well.
The picture above shows how a wall can be installed properly with "tie-back" structures to hold the wall straight. This is a wooden wall, but others use similar construction. Installing a drain pipe and allowing water a place to drain is important was well to keep a wall from leaning.