A free standing garden wall and a retaining wall look similar and behave entirely differently. The first carries only itself and fails slowly; the second is holding back soil and water, and when it fails it does so suddenly. Before worrying about any leaning brickwork, establish which of the two you are looking at.
If the ground is appreciably higher on one side than the other, it is retaining, and it deserves more attention than its appearance suggests.
Judging a free standing wall
Look along it from one end, which shows a lean or a bow far better than standing square to it. A gentle consistent lean that has been there for decades, with sound mortar and no open cracks, is usually stable and old.
What matters is movement and the coping. A crack that has opened recently, a section that is out of line with the rest, or a wall that moves when pushed firmly all mean it is going. The coping on top is what keeps water out of the core, so missing copings or failed bedding is the fault that will eventually destroy an otherwise sound wall.
Retaining walls and water
Most retaining wall failures are water failures rather than weight failures. Soil behind the wall saturates, the water has no way out, and the pressure it exerts is far greater than the dry soil alone. That is why drainage behind the wall matters more than its thickness.
The small gaps left in the lowest course are weep holes, and they are there to let that water out. Blocked, pointed up or buried, they turn the wall into a dam. Clearing them is the single most useful thing you can do to an old retaining wall.
The signs that need acting on
Bulging in the middle of the height, a lean that has increased, horizontal cracking, mortar being squeezed out of joints, soil or water escaping through the face, and a gap opening between the wall and whatever is beside it. On a retaining wall any of these is serious.
Mark a crack with a dated pencil line across it and photograph it. A crack that has not moved in a year is a different problem from one that has, and that is worth knowing before anybody quotes.
What not to do
Do not raise the ground level behind a retaining wall, which increases the load it was never designed for. Do not pave or render over the weep holes. Do not repoint a bulging wall and consider it addressed, since pointing adds no strength and hides the evidence.
Anything over about a metre of retained height, or any wall showing the signs above, wants a structural engineer rather than a bricklayer's opinion. Rebuilding a retaining wall properly involves drainage and foundations that are invisible in the finished job.
Who is responsible
Boundary ownership is set out in the deeds, and the common assumptions about which side owns a wall are not reliable. Where a wall retains a neighbour's ground, responsibility can sit with whoever benefits from the retention rather than whoever it stands on.
Establish that before spending anything, and raise it with the neighbour early. A shared wall repaired by agreement is straightforward; the same repair argued about afterwards is not.