I simply go by my ears: if it sounds good, I don't care what key it is. ^^
But maybe my ears are already trained on recognizing same keys as sounding good, since I've been playing instruments and making music for about 20 years. If you're unsure, I'd go with what music theory says though, just to be on the safe side.
Well, that was not really helpful I guess.
There are a ton of good videos on music theory on youtube though. To be at least a little helpful I found one that might be of use: https://www.youtube.com/watch?v=_oqXAAoPSz4