Its actually kind of tricky to define key, but one way of thinking of it is the collection of notes that is used to play the melody and form the chords of a song.
So when we say that the first part of Still Alive is in the key of D major, we mean that the melody mostly (in this case, always) uses notes that are found in the D major scale. That collection of notes is D, E, F#, G, A, B, and C#. You will not hear the melody play a C natural, or an A flat, in the beginning of the song, since those notes are not in the D major scale and therefore not in the key of D major.
Furthermore, the chords that play under the melody are formed using those same notes. The D major chord? Thats the notes D, F#, and A.
It would be unusual (but not unheard of) to have an E major chord in this song, since that chord is made up of these three notes: E, G#, and B. While the E and B notes are in the key of D major, that G# note is not. If an E major chord did show up, it would be a sign that wed left the key of D major, even if only for moment.
But an E minor chord? That has a G natural instead of the G#, so that does fit the key of D major. You very well might find that chord in this song. Just sayin...
Finally, the key sort of indicates the place where the song comes home to rest. The tonal center that everything sort of gravitates toward. But thats getting a little hippie-dippy, so well move on...
When Still Alive shifts to the key of F, suddenly it starts using notes from the F major scale collection: F, G, A, Bb, C, D, and E. Notice that the F and C are no longer sharp like they were when you were in the key of D major. And the B is not longer natural... its flattened. The chords behave likewise and are chords that are made up of this new set of notes.
Now just because a song is written in, and/or originally performed in a certain key doesnt mean you cant play it in a different one. Thats called transposing, and people do it to better fit their vocal range, or because certain keys are easier to play on their instrument than others, etc. You just play the same melody but starting on a different pitch and using a different collection of notes. The chords are adjusted too so they still fit the newly re-pitched melody. No biggie.