I read somewhere that classical composers modulate using a fifth. I think they did this because it's the smoothest key change as scales only differ between one note when they do that. So was that the primary way they modulated keys or were there other main ways they did so?
In major keys, classical composers most frequently would modulate up by fifth to the key of the dominant (V), even in a short piece. While part of the rationale for choosing the dominant was probably the closeness in scale, it was also because dominant chords became associated with "tension" that needed to resolve at cadences in classical style. Moving to the dominant key created another form of tonal tension that would then resolve when the piece modulated back to the tonic.
In major keys, another frequent destination for modulation was the subdominant (IV), which would move down by fifth. This was often employed (especially as a temporary tonicization) near the end of a piece or movement as a kind of "counterbalance" to the move to the dominant earlier. So-called plagal motion toward the subdominant created less tension and was therefore associated with "winding down" a composition. (Modulations to the subdominant also sometimes occurred in contrasting middle sections, akin to trios in ternary forms.)
Both of these types of modulations were only one step around the circle of fifths. Other common modulations did tend to vary the scale as little as possible, such as the move between relative minor and major (which would only differ in the use of the leading tone for the minor key), which was the most common modulation for classical composers when beginning in the minor mode.
However, when composers wanted to modulate farther afield, there were all sorts of techniques that could be used, rather than motion around the circle of fifths. It's true that one could eventually get to any other key (in the same mode) by moving around the circle of fifths, but modulating more than a couple steps at a time around the circle of fifths was rare, particularly when moving in the sharp direction. (Moving in the flat direction was a bit easier, as the standard dominant-tonic relationship would carry the progression forward through multiple steps around the circle of fifths, even in a short progression.)
For example, suppose a composer wanted to move from C major to A major. To make a convincing modulation using the circle of fifths would require that the piece pass through both G major and D major on its way to A major. That could be done, but it might take several phrases so as not to sound too sudden and forced. However, instead of going around the circle of fifths, a piece instead could choose to hold on to a common tone between the keys (like the E that is present both in a C major chord and an A major chord, as well as in the dominant of A, that is, an E major chord). By letting the rest of the texture drop out momentarily and holding that E while reharmonizing it to a new chord, a piece could jump directly and add three sharps (or more) to its scale.
For moving even farther, there were still other techniques, involving more exotic chords like Neapolitans, augmented sixths, and diminished seventh chords, which could all be used as chords that might be interpreted one way in one key, but then serve as a common chord interpreted completely differently in a very remote key. These common chords could serve as a type of bridge between the two keys. When modulating would involve adding five or six sharps/flats, these would be much more efficient than trying to move one step at a time around the circle of fifths.
Modulation would also be accomplished by going to the relative key, root going up or down a minor third : down if the original tonality is Major, up if minor (i.e. CM <-> Am ; Dm <-> FM ; etc ).
Another common way is to modulate to any other tonality only sharing a common chord, asserting the new tonality using a cadential harmonic movement (i.e. V-I, I beeing the transition chord and V its dominant)
There are many others ways, those two beeing very common.
it is hard to know for sure exactly what was in the minds of the classical composers.
Remember that the circle of 5ths is just one representation of the commonality between the keys of the 12 tone system.
Considering the thought that music might be the space between the keys, rather than the keys them selves; It might have been that the composers were more interested in generally deciding which key to move to from some other key.
This is a contrast from following the circle of 5ths and thinking about which key to play.
We play the space between the notes just as much as we play the notes.
Most frequent are probably modulation to the subdominant or dominant.
Relative key and parallel key
Modulation to the mediant key