Songwriting basics: The music theory you need to write a chord progression to fit a melody

It almost goes without saying that a good chord progression is fundamental to a good song, but when you find yourself facing the dreaded blank screen, how do you string a suitable set of chords together? 

It’s worth noting that the chord progressions used in most pop songs are relatively simple, mostly made up of a cycle of between two and four chords that are diatonic to the song’s key.