Concept:"Went on" in this sentence means "continued," and after this meaning, the next verb must take the gerund form, which is the
−ing form.
Explanation:"Went on" is used here to mean "continued."
When "go on" means "continue," it is followed by a gerund, not an infinitive or a past-tense verb.
"Speaking" is the gerund form of the verb "speak."
Therefore, the correct sentence is: "He went on speaking foolishly."
Option A, "to speak," is an infinitive and does not fit this sense of "went on."
Option B, "spoke," is the simple past tense, so it cannot follow "went on."
Option D, "to do speaking," is unnatural and grammatically incorrect here.
Thus, the correct answer is option C.
Answer:C. speaking