I think the best explanation is that some verbs are generally followed by an ing form, while some take the infinitive form.
I'll enjoy working for the school.
Not: I'll enjoy to work for the school.
I'll agree to listen to her song.
Not: I'll agree listening to her song.
Used in the context you have presented Spend requires the ing verb, and Take requires the infinitive.
I'm not a teacher.