It is really a question of contraction or otherwise.
The auxiliary verb do, just like are and have are usually contracted in spoken English (I'am going; he's coming etc.) though in formal written English I, for one, usually do not.
What is happening is that we are pronouncing the main verb (i.e. where most of the meaning is) with an additional "tag-on" which adds something, like a tense, or manner in the case of the modal auxiliaries (can, must, will etc.)
Do contracts a little diferently from the others and in fact does not use an apostrofe.
For example: You like pizza is actually a contraction of You do like pizza.
You will have noticed that when we make questions we invert auiliary and subject (you are coming vs are you coming?) and in questions we insert not after the auxiliary (you are coming vs. you are not coming).
The same happens with do (you do like pizza vs Do you like pizza/You do not like pizza), where it reappears in the question (uncontracted) and negative form.
As stated it tends to be more emphatic: I don't like tea but I do like coffee, for example.
Exactly the same happens with did but with the variation that the contraction is attached to the end of the base form (I did ask vs I ask-did = I asked) The actual spelling (d or ed) is just a convention and pronunciation is actually 'd, 't or id, depending on the last consonant sound in the main verb.
Questions and negatives follow the standard rules (did you, did not...) and the custom applies also to irregular verbs. (I spoke vs I did speak)