Modulation
A change of key inside a piece, most often to a closely related key, made through a chord the two keys share.
A modulation is heard when a new note keeps coming back, F♯ in place of F in a piece in C major, and then a cadence settles in G. A major key most often moves to its dominant, a minor key to its relative major.
The easiest way across is a chord both keys have. A minor is vi in C major and ii in G major; after it, D7 belongs to G alone, and G sounds like home.