How the blocks are counted
Visible courses are the wall height divided by the block height, rounded up. Below grade, bury about 1" of wall for every 8" of height, and never less than 6". That keeps the bottom from kicking out. The buried course needs as many blocks as any other.
blocks = (visible + buried courses) × ⌈length × 12 ÷ block length⌉ × 1.05
Caps sit on top and aren't counted in the height. Glue them down with concrete adhesive.
Base and drainage
The wall sits on a compacted gravel pad, typically 24" wide and 6" deep. Behind the wall, a 12" zone of clean drainage stone lets water out so it doesn't build pressure. A perforated pipe at the bottom of that zone carries water to daylight. Stone tonnage uses 1.4 tons per cubic yard.
Height limits
Many jurisdictions require a permit and an engineered design for retaining walls over 4 ft. Walls that hold up a driveway, a slope or a building need engineering at lower heights. Block makers publish their own maximum heights for walls without geogrid reinforcement. Check your block's install guide.
Questions
How many blocks for a 20 ft wall, 2 ft high?
With 12×4" blocks: 6 visible courses and 2 buried, 20 blocks per course, so 168 with 5% extra and 20 caps.
Can I skip the drainage stone?
Water pressure behind the wall is the most common reason block walls bulge and fail, so don't skip it.