The source containing the most detail is probably al-Ḥawādit̠
al-ğāmiʿa wa-l-tağārib al-nāfiʿa fī l-miʾa l-sābiʿa, a local history of Baghdad under Mongol rule. It was previously attributed to the librarian and historian Ibn al-Fuwati, but this is now considered erroneous and the author remains unknown.
Al-Ḥawādit̠ al-ğāmiʿa reads almost like a newspaper and contains plenty of insightful details not to be found elsewhere. Although the
author seems to have been committed to the Mongol rulers, the
representation of the events is not exceedingly apologetic or
Source: Hend Gilli-Elewy, 'Al-awādi al-ğāmia: A Contemporary Account of the Mongol Conquest of Baghdad, 656/1258'. In 'Arabica: Journal of Arabic and Islamic Studies' (2011)
This account does not skimp on the brutality of the aftermath. Here is a translated excerpt:
The inhabitants of Baghdad were put under the sword on Monday, sạ far
5 [February 11], and were subjected to 40 days of continuous killing,
pillaging, enslavement; and they tormented the inhabitants using
different ways to torture and extort their wealth with severe
punishment. They killed men, women, youth and children,....A great part of the city, including
the caliph’s mosque and its surrounding were burnt, and the city was
laid in ruins. The dead lay as mounds in the streets and the markets.
Rain fell on them, horses trampled down upon them, their faces were
disfigured, and they became an example to anyone who saw them. Then,
peace was proclaimed and those that were left came out from hiding.
The above entry concludes with this on the survivors:
Their color had changed, their minds shocked by the sight of the
horror that no words can describe. They were like the dead emerging
from their graves the day of resurrection fearful, hungry, and cold.
Source: Cited in Hend Gilli-Elewy
A little later, the Persian historian Rashid al-Din Hamadani (lived 1247 to 1318) wrote Jami'al-tawarikh, or Compendium of Chronicles. Below are some illustrations from this manuscript depicting the siege and sack of Baghdad.
Source: Ğāmi‛ al-tavārīḫ. Rašīd al-Dīn Fazl-ullāh Hamadānī, folio 181r, scanned by Bibliothèque Nationale de France.
"The Sack of Baghdad in 1258. (Image: Rashid-ad-Din’s Gami’ at-tawarih/Public domain)" Source: The Great Courses Daily.
Another important source for the 1258 sack of Baghdad is a work by the Persian historian Atâ-Malek Juvayni (lived 1226 to 1283). His account, Tarikh-i Jahangushay or The History of The World Conqueror, uses the accounts of survivors. He was also with the Mongol leader Hulagu Khan during the sack of 1258. A copy translated into English can be found in the UNESCO digital library.
There is also Wassaf al-Hadra (lived c.1265 to 1328), a Persian historian and author of Tajziyat al-amṣār wa-tazjiyat al-a'ṣār, or The allocation of cities and the propulsion of epochs. Marco Polo (lived 1254 to 1324) also wrote about the sack, as did the Persian polymath Nasir al-Din al-Tusi who - like Juvayni - was with the Mongol invasion force.
The claims that the Tigris turned red (butchered inhabitants) and / or black (ink from books) does not seem to appear in the earlier sources. The local source cited at the beginning of this answer, Al-Ḥawādit̠ al-ğāmiʿa, makes no mention of the River Tigris turning red or black. It would probably be safest to treat such claims as literary embellishment; many poems were written over the centuries on the sack of Baghdad, and artistic licence has to be expected. One likely example of a later, at least partially inaccurate, account comes from Qutb ad-Dīn an-Nahrawālī, a sixteenth century scholar from Mecca:
They threw the books of the Baghdadi colleges into the Euphrates (baḥr
al-furāt) and [the books] were so many that they became a bridge on
which the riders and footmen passed, and the color of the river
changed into black from their multitude.
Cited in Michal Biran, 'Libraries, Books, and Transmission of
Knowledge in Ilkhanid Baghdad'. In 'Journal of Economic and Social
History of the Orient' (62, 2019)
Biran goes on to observe that:
The mention of the Euphrates instead of the Tigris, as well as the
description of Hülegü as arriving at Baghdad after annihilating the
Khwārazm Shāh (whose kingdom was conquered by Chinggis Khan, Hülegü’s
grandfather, in the 1220s), suggest that by the 16th century, if not
already by al-Qalqashandī’s times [i.e. mid 14th to early 15th century], the Mongols’ destruction of the
books became a literary trope associated with the conquest of Baghdad
and magnifying Mongol barbarity.
In a footnote, Biran notes another example of a dubious claim as to what happened to some of the books:
...the anonymous mid-14th-century chronicle Mukhtaṣar akhbār
al-khulafāʾ (“Abridgement of the History of Caliphs”)...claims that
the Mongols built mangers from the books of the Baghdadi ʿulamāʾ. The
fact that Mongol horses were usually fed on pasture, without mangers,
does not give credibility to this description.
Interesting, and in the same footnote, there is also this:
...the early-15th-century travelogue of the Andalusi Ibn al-Sabbāḥ, in
which tearing books to pieces, throwing books into the Tigris, and
killing scholars — albeit Shiʿites — are ascribed to the last Abbasid
caliphs, al-Mustanṣir and al-Mustaʿṣim, and not to the Mongols.
In short, the authors of sources often had an agenda, although this should not be taken to mean that the destruction - human and material - in Baghdad was not devastating. Further, it is not implausible that pools of red or black briefly developed in parts of the river where there were lots of bodies or books, before being dispersed by the current.
There is clear evidence that not all books were destroyed during the sack; there were books that survived, just as their were human survivors. After the sack, in 1258-59, Hulagu appointed Nasir al-Din al-Tusi Minister of Wagf (endowment), agreeing to the building of an observatory and the gathering of both scholars and books. It seems evident from Tusi's own words that some books did survive the sack of Baghdad:
He [Hulagu] sought philosophers having knowledge of
observation....They chose Maraghah as the place for the observations
to be made, and applied themselves to this task, making instruments
and erecting buildings suitable for the purpose. He [Hulagu] also
ordered them to bring books from Baghdad, Syria, Mausil and Khurasan,
and to put them in the place where they would make observations, so
that the whole affair went forward in excellent order. The fame of
this great work spread throughout the world.
Source: Abdulhadi Hairi, 'Naṣīr alDīn Ṭūsī his supposed political role in the Mongol invasion of Baghdad' (Master's thesis, 1968)
The Al-Ḥawādit̠ al-ğāmiʿa source also mentions "gemmed" books being exchanged for desperately needed food brought to Baghdad from nearby settlements by opportunistic vendors. It is quite likely that such books were also often destroyed or discarded once the gems had been removed. Where these books - and the ones sent to the observatory - came from exactly is not stated, so they could have been from any of the public libraries or from private collections.