There must be some sort of shortlist to an extent which is possibly why they have themes? IIRC, last year there was a disagreement between Dannii and Louis. Louis said that Dannii "stole his acts song choice". In the end, Simon defended Dannii as apparently each week, the judges take it in turns as to who has first pick of the songs.
From my understanding, I think broadcasters can purchase a special copyright licence to use pretty much any song (like a radio station has to have), though there of course will be certain acts that will opt out of this - especially if they don't want their songs to be used on talent shows. For example, some artists opted out of the licence agreement with Spotify specifically, so I would imagine such a thing would be the same for shows like the Xfactor.
I initially thought there might be some kind of shortlist that the producers drew up, but since Simon chose and unreleased Whitney song for Danyl to sing I figured that as long as it's covered by the licence agreement, anything goes.