The Buddha explains the twelve links of dependent co-arising, and how there is an arising and ending of the whole mass of suffering.
Paṭiccasamuppāda sutta - Dependent Co-Arising
Thus have I heard — at one time, the Blessed One was dwelling in Sāvatthi, in Jeta's Grove, Anāthapiṇḍika's park. There, the Blessed One addressed the bhikkhus: "Bhikkhus."
"Venerable sir," those bhikkhus responded to the Blessed One. The Blessed One said:
"I will teach you the dependent co-arising. Listen well and pay close attention, I will speak."
"Yes, venerable sir," those bhikkhus responded to the Blessed One. The Blessed One said:
"And what, bhikkhus, is dependent co-arising? Dependent on ignorance, bhikkhus, volitional formations [arise]; dependent on volitional formations, consciousness arises; dependent on consciousness, name and form arise; dependent on name and form, the six sense bases arise; dependent on the six sense bases, contact arises; dependent on contact, sensation arises; dependent on sensation, craving arises; dependent on craving, clinging arises; dependent on clinging, existence arises; dependent on existence, birth arises; dependent on birth, aging and death, sorrow, lamentation, pain, displeasure, and despair arise. Thus is the arising of this whole mass of suffering. This is called, bhikkhus, dependent co-arising.
With the complete fading away and ending of ignorance comes ending of volitional formations; with the ending of volitional formations, ending of consciousness; with the ending of consciousness, ending of name and form; with the ending of name and form, ending of the six sense bases; with the ending of the six sense bases, ending of contact; with the ending of contact, ending of sensation; with the ending of sensation, ending of craving; with the ending of craving, ending of clinging; with the ending of clinging, ending of existence; with the ending of existence, ending of birth; with the ending of birth, aging and death, sorrow, lamentation, pain, displeasure, and despair cease. Thus is the ending of this whole mass of suffering."
The Blessed One said this. The bhikkhus were satisfied and rejoiced in the Blessed One's words.