Ones trust in history can to an extent be attained through the clues, evidence, proof and fame that have been passed down generation after generation and from era to era. The clues and evidence for certain incidents in history are so many that hardly anyone can doubt in their occurrence.
Even if there are chances of forgery and alteration in some cases, such a matter has no effect whatsoever on our trust in hadiths, because we have the science of Rijal whose job is to introduce reliable narrators of hadiths to us and put aside weak and unreliable narrators; this science has developed different methods for the protection of the text of hadiths, most notably: presenting the hadiths to the imams and scholars, comparing copies, permission for narration, the indexical method, etc. It is through such means that a majority of the hadiths that are mostly gathered in hadith collections, especially the four major sources (Kafi, Istibsar, Tahdhib and Man La Yahduruhu al-Faqih) have been evaluated and the reliable ones with acceptable chains of narrators have been identified. In addition to all of this, the ulema (i.e., scholars) and jurists today, especially experts in Rijal and Dirayah, like watchmen, are making every effort to preserve and refine our valuable hadiths, which after the Quran, are the most important treasure of Islam.
History is the study of past events and can sometimes be somewhat of a teacher for us. A historian needs to be very precise and accurate if he doesnt want the history he tells to suffer from alteration and inaccuracy. The reason we trust in history (as some historians such as Ibn Khaldun have said), is that before narrating or recounting a historical event, the historian first assesses the different dimensions to it to ascertain its coherence with intellectual principles and laws and whether it reads with the characteristics of the person(s) the event has been narrated about. Unlike some statistics in history that just dont make any sense. Therefore, if a historian is accurate in his reports of history, the chances of inaccuracy will drop, although there may be cases in which false events are narrated or there is exaggeration, but even these can be resolved through considering the evidence and clues that are out there. After taking all of this into consideration, one can then trust in history.
Now, even if we accept the fact that there inaccuracy and alteration indeed does exist in history and its accounts, but its a different story when it comes to trusting in hadiths and their narrators, and whether or not a certain narrator actually existed or was reliable; although there are also chances of alteration and inaccuracy, we dont just accept a hadith because it is located in a hadith book, without scrutinizing it. If this was the case, then there was every right to doubt in the authenticity of hadiths, but the truth of the matter is that when it comes to hadiths and their authenticity, a lot of work is done through the sciences of Rijal and Dirayah (Rijal has to do with the reliability and unreliability of narrators of hadiths and Dirayah is the science that deals with the content and text of hadiths) in order to determine the authenticity of a hadith and reliability of its narrators, and until verification of these aspects and achieving certainty of such, a hadith is not relied on.
There are different methods for gaining trust in the authenticity of a hadith:
1) Authentication of the text and chain of narrators
The infallible Imams were the first ones who warned against the infiltration of forged ḥadīths into Shiite aḥadīth. They would mention the name of the forgers and would point to the kind of ideas and thoughts that they had forged. Imam Jafar al-Ṣādiq is reported to have said, May Allah curse Mughayrah bin Saīd. He would attribute lies to my father. May Allah make him feel the heat of the Fire. May Allah curse those who say about us what we do not say about ourselves. May Allah curse those who deny us being servants of Allah, who has created us, to whom is our return, and in whose hand are our forelocks. These warnings led to rejection of the chain of narrators and texts that contained the names and the ideas of these deviant groups, and the Imams companions and the Shiite narrators were able to carefully delete such deviations to a great extent.
Purification of the aḥadīth continued with the authors of the Four Books (al-Kāfi, Man lā Yaḥḍuruh al-Faqīh, Tahdhīb, Istibṣār). These pious and knowledgeable scholars testified that they had collected the aḥadīth that they believed to be authoritative (ḥujjah) between them and their Lord, i.e., the ones they considered to be authentic (Ṣaḥīḥ). And we know that the early scholars would use the term Ṣaḥiḥ for the ḥadīth they were confident had actually been said by the Infallibles. This confidence was a result of scrutinizing the text and the chain of narrators of that Ḥadīth.
At any rate, before the compilation of the four Rijāl books (i.e., al-Rijāl by al-Kashshī, al-Fihrist by al-Najāshī,and al-Rijāl and al-Fihrist by al-Ṭūsī), our scholars had several Rijāl works, such as the works by Abd Allah b. Jabala al-Kinānī (d. 219 AH), Muḥammad b. Isā al-Yaqṭīnī, Ḥasan b. Maḥbūb (d. 224 AH), Ḥasan b. Alī al-Faḍḍāl (d. 224 AH), and others. This means that following the instructions of Ahlulbayt (AS), our Ḥadīth narrators were very careful about the aḥadīth they collected; they would not collect just any ḥadīth they found, but only the ones that met a set of critical standards. After that, the four Rijāl books were compiled. These books contributed greatly to knowing the narrators and theḤadīth collections and to authenticating the attribution of those collections to their alleged authors.
B) Textual authentication
To purify the texts of the aḥadīth from any kind of intentional or unintentional alteration and forge the following methods were used:
1) Presenting the aḥadīth to the Infallible Imams (AS) and the scholars:
One of the ways used especially by the companions of Imam Riḍā (AS) and the later Imams to check the authenticity of the aḥadīth was checking them with the Imams (AS) or their renowned and reliable companions. This method, called in our aḥadīth arḍ al-ḥadīth (presenting the ḥadīth [to the Imams or the scholars]), shows itself mostly in the first phase of collecting the aḥadīth, i.e. the period of presence. The method of presenting the ḥadīth was a constant procedure that always accompanied the process of narration. In the early ḥadīth literature, instances of presenting the aḥadīth to Imam Alī (AS), Imam Ḥasan (AS), Imam Ḥusayn (AS), Imam Sajjād (AS), Imam Bāqir (AS), and Imam Ṣādiq (AS) are found. Presenting several ḥadīth collections to Imam Ṣādiq (AS) indicates an increase in the application of this method in the Imams period; a period in which the identity of Shiism was consolidated and the Jafarī Shiism separated its way from the Zaydiyya and other sects. The companions and narrators who were educated in this school became measures for authenticating what was attributed to Shiism and to the Imams, and they in turn secured the Shiite ḥadīth heritage by presenting their ḥadīth collections to the Imams (AS).
One of the most important deviant trends of this period is the trend of Exaggeration (ghuluww). The Exaggerators were power-seekers who elevated the Imams (AS) to a divine status, and then claimed to be their deputies, in order to achieve their evil goals. The Infallible Imams (AS) were aware of these deviant groups and their danger, and they would inform others of the threat they posed. Instances of such treatment can be found in the main Rijāl books, especially Rijāl al-Kashshī, in the case of Exaggerators like Abū al-Khaṭṭāb and Yunus b. Ẓabyān.
It is reported that Yunus b. Abd al-Raḥmān presented several Shiite ḥadīth collections to Imam Riḍā (AS), and the Imam (AS) rejected many of the aḥadīth contained in one of them.
It is also reported that the books of Banū Faḍḍāl were presented to Imam Ḥasan al-Askarī (AS). In this case, the Imam (AS) verified the aḥadīth recorded in them.
The method of presenting the aḥadīth caused naivety to disappear, and the ludicrous forgers to be driven away from the Shiite ḥadīth enterprise. The frightful suspicion that the Imam (AS) would reject a ḥadīth was enough to bring down the hypocrites who had infiltrated into the lines of the Shiites from the position of narrating aḥadīth and ban them from its pure territories though they were not completely removed from it.
2) Comparing the copies
From an early period, the scholars of Islam and the companions of the Prophet (PBUH) and of the Imams (AS) used to check their own Ḥadīth collections with the original or authentic sources. This was an effort for purifying and correcting the intentional and unintentional alterations and forges.
3) Permission for narration
The Ḥadīth scholars have regarded permission for narration as one of the most important ways of receiving Ḥadīth and a supporting evidence for authenticity in the process of narration. They ask their teachers for permission to narrate the aḥadīth that they have learned from them. The teachers then give an oral or written permission, often containing the name of their own teachers and the titles of their works, to their qualified and trustworthy students. For instance, Aḥmad b. Idrīs al-Asharī al-Qummī was a famous faqīh and ḥadīth scholar and one of the prominent figures of the third century in Qum, who had the honor of visiting Imam Ḥasan al-Askarī (AS). He studied different disciplines of knowledge with great Imami scholars of his time, such as Aḥmad b. Isḥāq al-Qummī (the representative of the twelfth Imam AS), and was able to write precious compilations in fiqh andḥadīth. He has narrated many ḥadīths from the holy Imams (AS). He was the teacher of great Shiite scholars and gave them the permission for narration. One of his most famous and important students is Muḥammd b. Yaqūb al-Kulaynī, who produced the most reliable Shiite ḥadīth collection, i.e. al-Kāfī,in which he directly narrates from Ibn Idrīs.
An important benefit of the tradition of permission for narration is preserving the connectedness of the chains of narrators to the infallible Imams (AS). In the later periods, the teachers usually mention the chain of narrators only up to one of the great scholars such as Mulla Muḥammad Taqī al-Majlisī, al-Shahīd al-Awwal, al-Allāma al-Ḥillī, or al-Shaykh al-Ṭūsī, because the chain of narrators from these scholars to the infallible Imams (AS) is well-known.
4) The Indexical Method
This is a method usually applied by the early scholars of ḥadīth, who would assess the narrations based on a certain set of criteria. For instance, the scholars of Qum were very sensitive about the Exaggeration currents; they would reject any narration that would in any way promote Exaggeration thoughts. Because of this, Ibn Walīd, for instance, while narrating all of the works written by al-Ṣaffār, does not narrate the latters Baṣāir al-Darajāt. Or, for instance, although he approves of the narrators mentioned in the book Nawādir al-Ḥikma, he excludes some them, not because they were unreliable, but the narration narrated by them in that book was not acceptable to him. Although each scholar may have a different way of using this method based on his respective opinion, it is a method applied for textual purification of the narrations.
5) The agreement of the ḥadīths text with the clear teachings of the Quran
Another method is checking the aḥadīth with the Quran. The Prophet (PBUH) and the holy Imams (AS) have been repeatedly reported to have said, Whenever a ḥadīth reaches you [allegedly] from us, check it with the book of Allah. Hold to the one that was in agreement with the Quran, and leave the one that was opposing the Quran, or refer it to us.
Moreover, Allah had appointed guards for the precious Prophetic heritage. These guards were the points of reference for the truth-seeking believers. One instance is Sulaym b. Qays al-Hilālī; he had discovered some of the origins of the confusions, discrepancies, and forges that the Prophetic ḥadīthsuffered from, and he came to the conclusion that the only secure way of transmission for the Prophetic Ḥadīth was through the Ahlulbayt (AS).
In sum, with the painstaking efforts of the Imams (AS) and their companions, we have received aḥadīth heritage which is rich and to a great extent authentic. However, the scholars do not regard further investigation about the text and the chain of narrators of a ḥadīth dispensable; they continue to search for additional evidence and criteria for distinguishing between the authentic and the inauthenticḥadīths. After these researches and based on such criteria and evidences, the scholars may reject aḤadīth which was previously regarded authentic. Examples include when a Ḥadīth (1) is clearly opposing the Quran, (2) is against the principles of our madhhab, (3) is rejected by the Scholars of Imāmiyya throughout Their history, (4) is said because of taqiyya, (5) has signs of forge. These and other sophisticated and technical methods are used today by the scholars to accept or reject aḤadīth.
Therefore, although we do see alteration and inaccuracy possible when it comes to history, but this causes no problem for us regarding hadiths and relying on them, because that is what the two sciences of Rijal and Dirayah have been set for; in Rijal the narrators and transmitters of the ahadith are examined thoroughly, and in Dirayah, the criteria for accepting a hadith and all types of hadiths are discussed and explained, leaving no room for any doubt on any hadith or narrator that has been completely assessed and confirmed using these two sciences.
 Ibn Khaldun Abd al-Rahman Introduction of Ibn Khaldun vol. 1 pg. 12 translated by Muhammad Parvin Gonabadi Institute for Book Translation and Publication Publications fourth print, Tehran 1359.
 Allamah Hilli Rijal Allamah vol. 1 pg. 3 Daar al-Dhakhaair Print Qom 1411 AH.