Retaining walls hold back soil, but they also hold back a great deal of water that drains into the soil. That hydrostatic (water) pressure can exert powerful force and can in time damage or destroy the retaining wall. Short walls or those on gentle slopes or with drainage to the side may escape this problem, but the issue can become critical on higher walls --- especially those built on steep slopes. The solution involves providing a way for that water to escape and not build up great pressure behind the wall.
Address a drainage issue before construction of a retaining wall. Check to determine the permeability of the soil --- that is, its ability to allow water to percolate or seep down into the subsurface. Clay or similar soils tend to trap water; a layer of clay or rock under the soil behind a retaining wall can act like a pond liner and trap water above it, creating hydrostatic pressure. Sandy or similar soils may allow water to percolate down without building up pressure. Have a soil test performed to resolve any questions.
Start a retaining wall with a good bed of gravel, extending about a foot on either side of the wall base. The bed will allow water that seeps down the back side of the wall to drain out through the gravel underneath it. Increase the drainage by placing perforated plastic pipe or similar commercial draining systems at the bottom of the wall. Build what's called a French drain: Line a tunnel at the bottom of the back of the wall with a special fabric tjhat allows water but not dirt to pass, then fill it with gravel to let water flow through.
Install "weep holes" in the wall as you build it. These are small openings through the wall that allow water to seep out rather than build up behind the wall. Face the back side of the weep holes with a fabric that will block dirt but let water drain through. Vary the number and spacing of weep holes depending on the soil condition; permeable sandy soil may not require weep holes. Use metal or plastic pipes in mortar joints or similar gaps in the wall.
Build vertical drains if heavy surface drainage becomes an issue. Dig holes behind the wall at intervals, and line them with fabric and gravel, like a vertical French drain, to capture heavy runoff and drain it down to flow out of the gravel or drainage pipe at the bottom of the wall. Add a drainage swale or depression a yard or so behind the wall to capture surface water, and drain it to a side outlet rather than let it collect behind the wall.