How did Ptolemy's model account for retrograde motion?
Ptolemy included epicycles in his orbits.
Ptolomy's model of the solar system was geocentric, where the sun, moon, planets, and stars all orbit the earth in perfectly circular orbits. The problem with perfectly circular orbit around the Earth is that they do not explain the occasional backward motion, or retrograde motion, of the planets.
The Greeks insisted that the motion of the planets be perfectly circular. Ptolemy modeled the planets making small circles around a point that orbited the Earth. These smaller circles were called epicycles, and they allowed the planets to move backward relative to the background stars.
Ptolemy's model took epicycles even further, using them to explain the brightening and dimming of the planets as well, by having epicycles attached to epicycles. While these epicycles did not perfectly explain the motion of the planets, it was the most accurate model until Kepler's laws simplified things.