Modulation doesn’t just mean a change of key, it also implies a transition from one key to another. The manner of making transitions is the art of modulation.
After studying the relative importance of consonant chords formed on the degrees of two modes with the same tonality (relative major/minor), its easy to understand by altering one of the main notes of any of these chords, a transition occurs. This transition immediately establishes new harmonic relations with the other chords, resulting in a different key from the original.
Lets compare the following examples:

Ex. A is entirely composed of chords belonging to the key of C major. Ex. B (which has the same start as Ex. A and equally belongs to C Major) contains, in the third chord, an F sharp which destroys the tonal impression of C and determines the key of G Major, because the notes C, D, E and F♯ (partially contained in the chord progression of the first 3 chords) can only form the scale of G Major.
Its important to recognize the role played by the third chord in each of the previous examples. In Ex. A, this chord is the supertonic (2nd) of C major. In Ex. B, it can only be the dominant (5th) of G major. As a result, in Ex. B, the progression from A to D isn’t a progression of upper fourths like in Ex. A, from the 6th to the 2nd degree in C, but a progression of the submediant (6th) of C to the dominant (5th) of G.
In this example:

the progression from the third to the fourth chord isn’t a progression of upper seconds of the tonic (1st) to the supertonic (2nd) of C, but a succession of the tonic (1st) of C to the dominant (5th) of G. — The consequences of these observations will be developed in the course of this chapter.
Thus, any modulation is caused by one or more accidentals that aren’t apart of the key we leave. The notes modified by the accidentals are Characteristic Notes.
There are numerous and various ways to modulate. Which is why it important to become familiar with the simplest modulations first so that one can understand the complex modulations later. Therefore, the student must practice modulating with consonant chords only, and research and study all the resources they offer, before continuing the same study with dissonant chords and with regard to melodic notes.