It is not the messenger, sal-Allaahu `alayhi wasallam who created these fake hadeeth, the messenger spoke with revelation, he spoke with the truth. The companions may Allaah be pleased with them all, those who sacrificed their lives for the deen, who sacrificed their wealth, their limbs, their time, their effots and their families were the noble ones who conveyed this knowledge to us, via ahaadeeth. They took the utmost care to capture everything the Messenger said and conveyed it to others. They also captured his actions and his tacit approvals, to convey this to their families and companions who weren't present.
For this reason, the companions and family of the prophet such as the Mother of the Believer's, `Aa'ishah, may Allaah be pleased with her and destroy those who have malice for her, narrated around 2000 plus ahaadeeth (if I'm correct). Other companions also conveyed large numbers including Abu Hurayrah, Abu Moosaa al-Ash`aree, Abu Sa`eed al-Khudri, may Allaah be pleased with them all. They passed these ahaadeeth to the next generation of Muslims to come, those who never saw, met or lived in the time of the Messenger, sal-Allaahu `alayhi wasallam. So this knowledge was verbally transmited to them, those who we refer to as the Taabi`een.
Some of the sahaabah and tabi`een had books with their narrations, for more information about these early books, search around for a treatise on hadeeth by Shaykh `Abdul-Ghaffaar Hassan Ar-Rahmaanee, rahimahullaah. Anyway, as the knowledge was trasmitted down the ladder of generations, people made mistakes in trasmitting hadeeth, they may not have mentioned who they heard it from (creating a missing link in the chain) and other such errors. The hypocrites, the liars and the shi`aa were guilty of fabricating ahaadeeth, making their own chains attached to the texts that they created (yet in some cases didn't even give a chain, what idiots!).
Anyone can say that the Prophet, sal-Allaahu `alayhi wasallam said/did/approved of such and such. But you cannot except that statement to be true, because there are many filthy liars out there, many forgetful and unrighteous people. So in order to judge the authenticity of the hadeeth, it shouldn't clearly contradict that which is authentic from the Qur'aan or the Sunnah. But a more in-depth study is to study the isnaad (the chain or narration) to see if it has any defects. If it doesn't even have a change, then it is unknown or even fabricated.
The study of hadeeth is very deep, to suffice I'm just going to give one quick example of a weak hadeeth. There exists a hadeeth (of `Alee I believe) that states that one places their hands on the navel when praying, however in the chain of narration is a man named `Abdur-Rahmaan Ibn Ishaaq. Now many of the people said that Ibn Ishaaq was abandoned, i.e. that for some reason his narrations are totally abandoned, maybe due to his character or weak memory or something or other. Due to this, ahaadeeth which have been transmitted through him will be rejected in general, but this may not always be the case.
I think this will suffice, I ain't well aquainted with ahaadeeth, so I don't really want to say more, however check out
this link for more info.