Obviously we all have our own voices and sometimes a song challenges one part of your range. I find some keys that I can sing well in for some songs, but it may be more challenging on other songs. It is the combination of notes that can be the problem, not the specific key, and another key allows you to get that combination of notes easier. There are some keys my voice fits in pretty naturally, and I do tend to gravitate to those keys. Most of the time when I write a tune, if I come up with the melody without having touched my instrument I may at random pick one of the keys I favor and not too surprisingly they are most often either D, E, G, A, or C, or their relative minors. The most frequent key I will grab to begin playing with a new melody is the key of D. It happens to be one of my favorites to sing in and there are marvelous guitar sounds on an acoustic that you can get out of the first position D and related chords. But I have to make myself be versatile so I might then try a few others to see how they go. I actually can sing in most keys depending on the style of song. I may be more limited if I have to hit certain notes with great power, or something like that. I might also pick a different key because of a particular guitar part I come up with works out well in a different chord form. Also, the style of song sometimes influences the key I choose, because the chord forms I would prefer to use.

I am rambling on here, but I don't have a simple answer for that Jim, it is often trial and error for me too. I have written many songs in the key of G, but then G is the people's key anyway. There are probably more songs written with guitar in hand in the key G than any other.