A lot of the simpler songs will have 3 chords - generally I, IV and V. In key C, C F and G
When the song is on one of these, and the player feels a change coming - which can happen naturally, otherwise comes with experience ( often called practice), there is a 50:50 chance of getting the next chord right by accident. As in, you're playing C, and you feel a change, there's only F or G that could fit (in a 3 chord song, obviously). After that change, there's still a 50:50 option for the next.
Let's face it, if the wrong choice is made, it's pretty easy to play the correct chord, albeit a little late! But how to get it right first time?
It's usually down to having played hundreds of songs, and there's a feeling that comes as to when the changes occur, and what they'll be.
Throw other chords into the pot, and the first that will be there are minors. Three of them, and there's often a feeling that one is coming in a song. So, 33% chance on this. Still pretty good odds.
By listening to many songs, and writing down what you think the chords might be, you'll improve. Also, take songs you already know - Happy B'day, children's songs, national anthem, and play slowly, in whatever key, knowing what choices of chords will most likely be available in that song.