Re: Key of Bassline, chords and vocals
Having the vocals in the same key will help them gel with the other elements and feel like they belong with your chords and bass line. Although you can get away with them not being in the same key too, depending on the effect you're going for.
Different genre's and styles will call for different things, and it'll largely depending on the role your vocals/phrase play in the song.
Maybe as an example, Raise Your Weapon by Deadmau5, would be a song where it's important that the key of your vocals would want to match your chords and bass line.
It plays a central role, it's a main melodic element. If it wasn't in key, it'd sound off.
Sometimes the vocals can be purposely out of key on certain notes to create tension within the music and add interest. Done creatively with a degree of tact and taste it can work really well.
Your bass line will usually follow the root note of your chord. The root note is the lowest note of the chord, which the chord is also named after. As Mario D mentioned already though the bass note doesn't always have to follow the chord it could be a 3rd or 5th of the root note of the chord.
Hell, it can be any other note in the same key too!
As someone who used to play bass guitar, it was a pet peeve of mine that I was expected to just play root notes of chords. Try mix is up a little to keep your bass lines interesting!
Try different notes in the same key and see how they interact with your chords.
If you're feeling super experimental try a note outside the key for effect.
Do it sparingly though, too many notes outside of your chosen key and you'll throw the listener, and for the most part they'll feel lost and like you've just selected random notes with no relation to one another.