It is a most tragic fact that people had started attributing forged traditions to the holy Prophet (peace be upon him & his progeny) even during his life time. The Prophet had to warn the Muslims of this fitnah in these words:
"Surely there are many who forge lie against me, and their number is sure to increase; whoever intentionally tells a lie against me should prepare his abode in the Fire. Therefore, whenever a hadith is narrated to you, put it (for testing) before the Book of Allah and my (established) sunnah, and whatever conforms with the Book of Allah, take it; and what goes against the Book of Allah and my sunnah, reject it." 
This well-known hadith is very important and I request you to keep it in mind. We should realize that the Prophet has appointed the Qur'an as the standard for judging a hadith, not that the Qur'an is to be judged by ahadith.
Amiru 'l-mu'minin 'Ali (a.s.) was asked as to why there were differences in the traditions attributed to the Prophet. In reply, he said, "Certainly what is current among the people is both right and wrong, true and false, repealing and repealed, general and particular, definite and indefinite, exact and surmised. Even during the Prophet's days false sayings had been attributed to him, so much so that he had to say during his sermon that 'Whoever attributes falsehood to me makes his abode in Hell'. Those who relate traditions are of four categories, no more."
Then the Imam said that the first category was of the lying hypocrites: "The hypocrite is a person who makes a show of faith and adopts the appearance of a Muslim; he does not hesitate in sinning nor does he keep aloof from vice; he willfully attributes false sayings to the Messenger of Allah-may Allah bless him and his progeny. If people knew that he was a hypocrite and a liar, they would not accept anything from him and would not confirm what he says. But they say that he is a companion of the Prophet, has met him, heard (his sayings) from him and acquired (knowledge) from him. They, therefore, accept what he says. Allah too had warned you well about the hypocrites and described them fully to you. They have continued after the holy Prophet. 
However, the situation became worse after the martyrdom of Imam 'Ali (a.s.), when amir Mu'awiyah established what may be called the first propaganda department in the world. It is not the place to go into sordid details. Those who wish to know more may see the Sharh Nahji 'l-Balaghah of Ibn Abi 'l-Hadid al-Mu'tazili, who quotes verbatim from Kitabu 'l-Ahdath of Abu 'l-Hasan 'Ali ibn Muhammad ibn Abi Sayf al-Mada'ini, showing how this department developed stage by stage until the ahadith fabricated by them permeated the whole Muslim world; these 'ahadith were taught to the children in maktabs like the Qur'an. He mentions how the malady had affected all groups and especially those who showed piety, recited the Qur'an, and were thought to be very God-fearing. They used to forge ahadith to seek favours with the rulers. Finally these 'ahadith' reached those who were really religious-minded and did not approve of lie and false attribution. They accepted the traditions as genuine and transmitted them thinking that they were genuine sayings of the Prophet. 
Four narrators of ahadith were the core of that department: Abu Hurayrah, Amr bin al-'As, al-Mughirah bin Shu'bah (all from the sahabah, companions) and 'Urwah bin az-Zubayr (from the tabi'in, disciples of the companions).  But there were hundreds of free-lancers who sold their religion for worldly gains. One incident is given here as an example.
Mu'awiyah once offered Samurah ibn Jundab one hundred thousand dirhams if he would narrate that the verse 204-205 of the second chapter of the Qur'an were revealed concerning 'Ali ibn Abi Talib, and that the verse 207 was revealed in praise of Ibn Muljam (the assassin of 'Ali).
The verses are as follows: "And among men is he whose speech about the life of this world causes you to wonder, and he calls on Allah to witness as to what is in his heart; yet he is the most violent of adversaries. And when he turns back, he runs along in the land that he may cause mischief in it and destroy the tilth and the stock, and Allah does not love mischief-making." These were to be attributed to 'Ali.
And the verse 207 which says "And among men is he who sells himself to seek the pleasure of Allah; and Allah is affectionate to the servants" was to be attached to Ibn Muljam.
However, Samurah did not agree. The price was raised to two hundred thousand and then to three hundred thousand, but to no avail. Finally Mu'awiyah offered him four hundred thousand dirhams, and Samurah agreed and narrated a 'hadith' to that effect. 
Shaykh 'Abbas al Qummi, Safinatu 'l-Bihar, vol. 2 p. 474. Countless
ahadith to this effect may be seen in the books of both sects, including
Sahih al-Bukhari, vol. 1 (kitabu l- ilm: bab ithm man kadhiba 'ala
n-Nabi ) p. 38.
Nahju 'l-Balaghah (translated by S. Ali Raza), vol. 2 (Tehran: WOFIS,
1987), pp. 453-545.
Ibn Abi l-Hadid, Sharh Nahji 'l-Balaghah, vol. 11 (Cairo: Daru 'l-Ihyai
'l-Kutubi 'l-Arabiyyah) pp. 446.
Ibid, vol. 4. p. 63.
 Ibid, vol. 4. p. 73.