Ability is a noun formed from able; if you have an ability, you are able to do something. Be able to is a periphrastic modal auxiliary; it means the same as can:
- Is he able to do that?
- Yes, he can certainly do that.
And, like all modals, it takes an infinitive complement, with the infinitive to complementizer in these periphrastic cases.
Nouns like ability that are formed from predicates like able that
take infinitive complements can also take infinitive complements, like (to) run a mile in 5 minutes below:
- He can run a mile in 5 minutes.
- He is able to run a mile in 5 minutes.
- He has the ability to run a mile in 5 minutes.
So the boldfaced infinitive clause below
- the ability to think of stuff
is the complement clause of ability, because it's the infinitive complement of be able, which means can.
Normally only nouns that come from verbs that take complements can take complements themselves; NP complements can be non-finite, like this infinitive, or they can be tensed, like the that-clause complement of the report (because the verb to report takes a that-clause complement):
- the report that she shot him twice
- they reported that she shot him twice