Certain (often negative) adverbial expressions, when moved to the front, force the verb into second position. But in the same way that when forming a question in English we add the dummy verb do, we also add the dummy verb do when forcing the verb into second position (unless there is already an auxiliary verb which can move into that position, or be as a main verb, which also does so).
The number of migrations not only varies with the month, but also with the type of species.
When changing the word order and moving the negative expression to the front, the verb is forced to move, but because we cannot say "Not only varies the number of migrations with the month", we must add the dummy do:
Not only does the number of migrations vary with the month, but also with the type of species.
He not only helped her but he also dropped her home safely.
We cannot say "Not only helped he her". In the same way that we introduce the dummy do when changing the word order for a question (so that we say "did he help her?" rather than "helped he her?"), we add the dummy do when moving the adverbial to the front:
Not only did he help her but he also dropped her home safely.
Now, if your sentence had contained an auxiliary (or be or have as main verbs), do would have been unnecessary (in the same way that do doesn't need to be added when inverting to form questions, if there's already an auxiliary in the sentence):
He must not only go there tomorrow but also the next day.
Not only must he go there tomorrow but also the next day.
She had not only seen him yesterday but also the day before.
Not only had she seen him yesterday but also the day before.
It was not only necessary but also desirable.
Not only was it necessary but it was also desirable.
Other adverbials that work the same way when fronted include "hardly", "scarcely", "no sooner", "under no circumstances", "never", "never before", "rarely". (Hardly had I seen it when it suddenly vanished.; No sooner did I pronounce these words than the genie appeared.; Under no circumstances can I accept your offer.; Never have I seen such a large house.) Note that in almost all cases, it is more natural to keep the original word order (I no sooner pronounced these words... etc); the inverted word order is a stylistic device and more often found in relatively formal writing than in speech (although it is quite common with "Not only").