What happens to notation (e.g. a melody line) when a tune is played in a different key than the one it was written in? Do the notes alter in any way or do they always stay the same as originally composed? In other words, if a tune was written in the kay of C and the melody begins with a C note followed by a D note, does that pattern of notes change to a different pattern, if the tune is played in a different key?
This is called Transposition.
For instance, if you are in C major and have this melody:
C-F-E-G-C and you move to E major scale, the melody would be:
You have to keep the intervals the same (A perfect fourth remains a perfect fourth etc), but the notes change.
There's two issues here: what happens in music NOTATION, and what happens in the MUSIC, when you transpose to a different key.
The short answer on the music notation is that the pitch intervals from note to note of a transposed melody don't change when you change the key, thus for example if you had a melody in the key of C, starting on the note E, then transposed that melody TO the key of E, then you'd write the key signature of E (four sharps), and your starting note would be a G#, but you wouldn't have to write the sharp, because it's in the key signature already. If there were no accidentals (sharps/flats) in the original melody in the key of C, then there would be no accidentals in the transposed melody, (beyond the four sharps of the key signature). If you had, say, a written note Bb in the key of C, when transposed to the key of E, that would be written as a D-natural, instead of a Db.
Now...there also ARE differences in tonality from key to key. Those differences are extremely subtle, tiny, but they're there. In other words, Nigel Tufnel wasn't completely blowing smoke when he declared that "..D minor is the saddest of all keys..."
Seeing as Major scales have semitones all in the same place transposing between different Major keys will still garner similar (If not identical) general Major tonality.
You often want to do this for practical considerations. Guitar music that is not written specifically for guitar almost always has to be transposed either to E / A or D.
This does not take away from the music if done correctly.
On the piano today you'll get only the sound of your melody or harmony higher in pitch (minus different resonances of the instrument itself). This is so because the piano is tuned equally (bad) ie. all keys sound the same. This is called equal temperament. Some people think it is bad because one could say only octaves are pure, the rest is an approximation.
Before 1900s it was common that different keys sounded different because of so called temperaments. Even earlier the keys were very distinct sounding (mesotonic tuning) because the main key was meant to be pure. This of course made composing restrictive.
Roughly saying claviers then were tuned so that major thirds were pure, later it was important to have pure fifths. The claviers/piano's themselves changed dramatically as well and had to be tuned differently. Thus tempered temperaments became fashion. Today's piano's have a more bell like sound, in the upper registers.
One notable composer named Johannes Sebastian Bach was especially interested in finding temperaments for the clavier (Bach's well tempered clavier) because he wanted to continue a piece in as many keys as possible without sounding (too much) out of tune.