Fast answer
Choose Monopoli when the trip needs an overnight base with old-town evenings, a working harbor, multiple beach choices, and rail access that can still support a Polignano day. Choose Polignano a Mare when the cliff-town setting is the fixed point of the trip and the traveler accepts the tighter, more visitor-compressed feel around the historic center.
If you only do one thing
For most first Puglia trips deciding between the two towns, Monopoli is the steadier base and Polignano is the sharper day-trip or short-stay comparison. The exception is a trip built around Polignano's cliffs, sea views, and compact old-town atmosphere; then Polignano can justify the overnight even if the base is less flexible.