Musical modulation means changes of the tonal center (the key) of a composition confirmed by a cadence. It is based on scales relations. First of all, when searching for a possible modulation from the previous key to the next one we are interested in closely related and relative keys. Modulation can be diatonic, chromatic and enharmonic. While chromatic and enharmonic types sound quite exotic and usually they serve to modulate to distantly related keys the most convenient and harmonious way to modulate is to use pivot chords of closely related keys. This method is classified as a diatonic type of modulation.
We may name the next key closely related to the previous one if the previous key contained the tonic triad of the next one. The main feature of these keys will be a similar key signature. Key signatures of closely related keys differ from each other by not more than one accidental symbol. Every key has five closely related keys from the natural scale plus one from the harmonic variant of the scale.
Related to major
Closely related to major will be the keys of its supertonic, mediant, major and minor subdominant, dominant, submediant (in C major: D minor, E minor, F major and F minor, G major, A minor).
Since any modulation begins with the tonic triad of the previous key, this triad should be renamed to the corresponding degree of the next key. So to modulate from C major to D minor (supertonic key) we need to equate the first degree to the seventh (I = VII). Then we add to this triad a chord progression of the fourth and fifth degrees (iv - V) and complete the cadence with the tonic triad of D minor.
The formula for modulating from C major to E minor (mediant key) may look like this: (I = VI) - ii65 - V - i.
Because the tonic triad of C major is dominant in F major and minor (I = V) possible modulation methods become obvious: (I = V) - V7 - I or (I = V) - V7 - i. However, in most cases, composers use a more complicated method by going first on the deceptive cadence to be able to get the subdominant chord of the next key: (I = V) - vi - IV - V - I or (I = V) - VI - iv - V - i.
When modulating to G major (dominant key) the tonic triad of the previous key will be equal to the fourth degree (I = IV). We can complete the modulation by adding the fifth and the first degrees of G major (V7 - I).
Possible modulation formula in A minor (submediant key): (I = III) - iv - V - i.
The seventh degree of C major (leading tone) has a diminished triad, as a result, it does not give a key for modulation.
Related to minor
Closely related to minor will be the keys of its mediant, subdominant, major and minor dominant, submediant, subtonic (in A minor: C major, D minor, E major and E minor, F major, G major).
The second degree of the minor scale (supertonic) has a diminished chord, so it does not give us a possible key for modulation.
To modulate from A minor to C major (mediant key) we need to equate its tonic triad to the sixth degree of the major scale (I = VI). Then we can add a chord progression of the second and fifth degrees (ii6 - V) and complete the cadence with the tonic triad of C major.
The fourth degree (subdominant key) is an exception and requires modulation through relative major.
Formulas for modulating from A minor to E major or minor (dominant key) may look like this: (i = iv) - V7 - I or (i = iv) - V7 - i.
When modulating from A minor to F major (submediant key) composers usually use the triad of the third degree to prepare the dominant chord (iii - V43) since they have two common tones.
Modulation formula in G major (subtonic key): (i = ii) - V7 - I.
Relative keys are a pair of major and minor which can be thought of as Ionian and Aeolian modes of the same set of musical pitches and therefore they share the same key signature. Also, it can be concluded that relative keys are a special case of closely related keys.
To perform good modulation from the previous minor to the next key of its subdominant (a - d) you should use a complicated method by modulating first to the major that is relative to the subdominant key (a - F - d). The reason for this is the contradiction between the minor tonic triad of our previous key and the major dominant triad of the next key.
Sometimes, to modulate from the previous major to the next key of its major subdominant (C - F) composers also use complex modulation through the relative minor (C - d - F).