For the most part it is pretty haphazard, although there are times when I think, "Why don't I know any Beatles songs? I should learn one," and I pick one out and figure out the chords and learn it. Mostly I hear a song and something strikes me about it -- whether it's the words or the melody or the guitar or piano part or the sense of humor or, for lack of a better or more specific term, the fact that it kicks ass -- and I listen to it a bunch of times because I like it so much, and then I get out the guitar or piano and try to figure out how it goes.
Once I've learned a song I try to figure out what I should do with it. In some cases I will a song for my own enjoyment, but I don't think my version is good enough to play in public ('I Walk The Line' for instance). In other cases, if the song is quiet or otherwise requires a lot of attention, I might play it at some of the quieter open mikes, but otherwise not give it any public performance. Songs which are pretty energetic or come across strongly enough that they will make an impression on someone who isn't really giving me their full attention is a good candidate for a noisy open mike or bar show.
I also have a few songs that I think are as close to crowd-pleasers as I've got, so I tend to play those a lot the first time I play a particular venue or open mike. 'That'll Never Happen No More', 'Big Road Blues', 'Hybrid Car', 'I Believe To My Soul', 'Watching Killer Robots Eat Your Head', and 'Railroad Bill' are the big ones in this category.