The donkey went to a well belonging to Abu Al-Haytham Ibn Al-Tahyan, threw himself committing Suicide out of sadness for the prophet’s death. This hadith was narrated by Abu Muhammad Ibn Abdullah Ibn Hamid, narrated by Abu Al-Hussian Ahmad Ibn Hadan Al-Sijsi, narrated by Umar Ibn Muhammad Ibn Bajir, narrated by Abu Jafaar Muhammad Ibn Mazid, narrated by Abu Abdullah Muhammad Ibn Akba Ibn Abu Al-Sahba’, narrated by Abu Huthaifa, narrated by Abdullah Ibn Habib Al-Hathli, narrated by Abu Abd Al-Rahman Al-Silmy, narrated by Abu Manthur who said:
"When Allah opened Khaybar to his prophet Muhammad (may Allah’s prayers and peace be upon him) – he (prophet) received as his share of the spoils four sheep, four goats, ten pots of gold and silver and a black, haggard donkey.
The prophet (may Allah’s prayers and peace be upon him) addressed the donkey asking:
What is your name?
The donkey replyed: Yazid Ibn Shihab, Allah had brought forth from my ancestry sixty donkeys, none of whom were ridden on except by prophets.
None of the descendants of my grandfather remain but me, and none of the prophets remain but you and I expected you to ride me.
Before you, I belonged to a Jewish man, whom I caused to stumble and fall frequently so he used to kick my stomach and beat my back.
The prophet (may Allah’s prayers and peace be upon him) said to him:
I will call you Yaafoor, Oh Yaafoor.
Yaafoor replied: I obey.
The prophet (may Allah’s prayers and peace be upon him) asked:
Do you desire women?
Yaafoor replied: No.
The prophet (may Allah’s prayers and peace be upon him) used to ride Yaafoor to complete his business and if the prophet dismounted from him he would send the donkey to the house of the person he wanted to visit, the donkey would knock at the door with his head. If the owner of the house answer the door, the donkey would signal him to go see the prophet.
Sources:
"The Beginning and the End" by Ibn Kathir, Chapter VI, {The Conversation of the Donkey}