First, we must understand “do” as an auxiliary verb have very limited use, mostly for questions and negations, and sometimes affirmative statements.
Examples of auxiliary “do” as follow:
Questions: Did I do that?
Negations: I did not do that.
Affirmative: I did drink coffee.
In question form, auxiliary “do” is only required to form questions. One of the things that differentiates auxiliary “do” and other auxiliaries/modals is that pleonastic “do” is inserted to fill the TENSE (TNS) space after subject–auxiliary inversion (SAI) applied.
For instance, auxiliary be/have and modal can can be moved to the front of the sentence to form a question.
Sentence structure as such: NP + TNS +VP → TNS + NP + VP
He (NP) is (TNS) dying (VP) → Is (TNS) he (NP) dying (VP).
You (NP) can (TNS) come to the party (VP) → Can (TNS) you (NP) come to the party (VP)
However, sentences like the following are ungrammatical without an auxiliary for TNS and cannot be a question themself. Therefore, auxiliary “do” must be added in the front of the sentence:
He (NP) (TNS - present) plays basketball (VP) → *Plays (VP-V) he (NP) basketball (VP - N)
Since “do” can be tensed, it reduces all tense maker to itself; from “do” to past form “did”, and both simple present forms “do” and “does”. The main verb does not gain tense and remains in its basic form. Question would be formed in modal/do + infinitive.
For negations and affirmative, “do” in simple present and past form are used with the negative statement “not” in negations and directly with main verbs in affirmatives. Again, the main verb after the auxiliary verb “do” remains its base form. In non-question sentences, auxiliary “do” only appear for stress and emphasis. In conclusion, we can say that the reason of the main verb after past tense “did” retains its base form is first, “do” as an auxiliary verb, the same as other auxiliary verbs in English, should have the main verb afterward retain its base form. Secondly, the tense of the sentence was transferred to the auxiliary verb “do”. “Do” conjugates the tense of the main verb, which is the main event, to the subject of the sentence. This explains why the verb after “do” remains its base form no matter the tense the sentence carries.