What is the proof that the Qur'an was not tampered with? Who wrote the Qur'an and when was it written? Can you give a brief history of it?
Bismillah (In the Name of Allah).
1] Firstly to address your question with regards to the proof that parts of the Qur'an was not tampered with:
Allah (سبحانه وتعالى) says:
إِنَّا نَحْنُ نَزَّلْنَا الذِّكْرَ وَإِنَّا لَهُ لَحَافِظُونَ
Verily We: It is We Who have sent down the Dhikr (i.e. the Quran) and surely, We will guard it (from corruption). [al-Hijr 15:9]
As opposed to other old scriptures whose protection and witnessing to were left to its people, the Qur'an is in fact the only scripture whose protection and preservation has been promised by Allah. Allah has promised to guard and protect the Qur'an Himself. So, that is our strongest proof that it has been preserved.
Allah (سبحانه وتعالى) describes the Qur'an:
...وَإِنَّهُ لَكِتَابٌ عَزِيزٌ (41) لَّا يَأْتِيهِ الْبَاطِلُ مِن بَيْنِ يَدَيْهِ وَلَا مِنْ خَلْفِهِ ۖ تَنزِيلٌ مِّنْ حَكِيمٍ حَمِيدٍ (42)
And verily, it is an honourable respected Book (because it is Allah's Speech, and He has protected it from corruption, etc.). Falsehood cannot come to it from before it or behind it (it is) sent down by the All-Wise, Worthy of all praise (Allah). [Fussilat 41:41-41]
To say otherwise is to disbelieve in how Allah describes the Qur'an in His words and to disbelieve in His promise.
2] As for the Qur'an being written, as we know the Qur'an was not written as a book would be written by an author. If by this statement it is implied that the Prophet (ﷺ) wrote the Qur'an then it must be corrected.
The Prophet (ﷺ) did not write the Qur'an because we know that he was an unlettered Prophet (ﷺ) sent to an unlettered nation. In Surah al-A'raf, Allah (سبحانه وتعالى) says:
قُلْ يَا أَيُّهَا النَّاسُ إِنِّي رَسُولُ اللَّـهِ إِلَيْكُمْ جَمِيعًا الَّذِي لَهُ مُلْكُ السَّمَاوَاتِ وَالْأَرْضِ ۖ لَا إِلَـٰهَ إِلَّا هُوَ يُحْيِي وَيُمِيتُ ۖ فَآمِنُوا بِاللَّـهِ وَرَسُولِهِ النَّبِيِّ الْأُمِّيِّ...
Say (O Muhammad ﷺ): "O' mankind! Verily, I am sent to you all as the Messenger of Allah - to Whom belongs the dominion of the heavens and the earth. La ilaha illa Huwa (none has the right to be worshipped but He); It is He Who gives life and causes death. So believe in Allah and His Messenger (Muhammad ﷺ), the Prophet who can neither read nor write... [al-A'raf 7:158]
Allah (عز وجل) says:
وَمَا كُنتَ تَتْلُو مِن قَبْلِهِ مِن كِتَابٍ وَلَا تَخُطُّهُ بِيَمِينِكَ ۖ إِذًا لَّارْتَابَ الْمُبْطِلُونَ
Neither did you (O' Muhammad ﷺ) read any book before it (this Quran), nor did you write any book (whatsoever) with your right hand. In that case, indeed, the followers of falsehood might have doubted. [al-Ankabut 29:48]
Az-Zarqani defines the Qur'an as,
The Qur'an is the Arabic Speech (kalam) of Allah, which He revealed to Muhammad in wording and meaning, which has been preserved in the mushafs, reaching us by mutawatir transmissions, and is a challenge to mankind to produce something similar to it.
'The Qur'an is the Arabic' — implies that the Qur'an is in the Arabic language. This, therefore, implies that a translation of the Qur'an into any other language cannot be considered the Qur'an.
'Speech (kalam) of Allah' — means that the Qur'an is the Speech of Allah, that He himself spoke in a manner that befits Him.
'Which He revealed to Muhammad' — implies that the kalam of Allah is infinite, as Allah (سبحانه وتعالى) says:
وَلَوْ أَنَّمَا فِي الْأَرْضِ مِن شَجَرَةٍ أَقْلَامٌ وَالْبَحْرُ يَمُدُّهُ مِن بَعْدِهِ سَبْعَةُ أَبْحُرٍ مَّا نَفِدَتْ كَلِمَاتُ اللَّـهِ ۗ إِنَّ اللَّـهَ عَزِيزٌ حَكِيمٌ
And if all the trees on the earth were pens and the sea (were ink wherewith to write), with seven seas behind it to add to its (supply), yet the Words of Allah would not be exhausted. Verily, Allah is All-Mighty, All-Wise. [Luqman 31:27]
Therefore, we know that the Qur'an was specifically revealed to the Prophet (ﷺ) and does not include any Speech that He spoke to other than the Prophet.
'In wording and meaning' — confirms that the words of the Qur'an are from Allah, that they are not from Jibril or even the Prophet (ﷺ). Allah (سبحانه وتعالى) says:
(وَإِنَّهُ لَتَنزِيلُ رَبِّ الْعَالَمِينَ (192) نَزَلَ بِهِ الرُّوحُ الْأَمِينُ (193) عَلَىٰ قَلْبِكَ لِتَكُونَ مِنَ الْمُنذِرِينَ (194
And truly, this (the Qur'an) is a revelation from the Lord of the 'Alamin (mankind, jinns and all that exists), Which the trustworthy Ruh [Jibrael (Gabriel)] has brought down; Upon your heart (O' Muhammad ﷺ) that you may be (one) of the warners, [ash-Shu'ara 26:192-194]
'Which has been preserved in the mushafs' — means that it has been guarded in the form of written copies of the Qur'an (mushafs). These words refer specifically to the copies that 'Uthman (رضي الله عنه) had ordered to be written during the time of his khilafah, which includes 114 Surahs.
'And has reached us by mutawatir transmissions' — means that it has reached us through a transmission by a large number of people, such that they could not all be mistaken or purposely come up with a lie. In each generation a tremendous amount of people narrated it that there is no question of its authenticity.
'And is a challenge to mankind to produce something similar to it' — implies the miraculous nature (I'jaz) of the Qur'an. Allah has challenged mankind to produce even a chapter similar to it, and this challenge is reserved for the Qur'an
3] Brief history of its compilation: When the Qur'an was compiled.
The Qur'an had three different stages of compilation beginning with the lifespan of the Prophet (ﷺ), its compilation through Abu Bakr (رضي الله عنه) and the last one being the compilation of 'Uthman (رضي الله عنه).
The earliest record of having the Qur'an written down was seven years before the hijrah, at the time when 'Umar ibn al-Khattab (رضي الله عنه) accepted Islam. The narration of his conversion story makes mention that his sister had a saheefa (form of paper) with her that one of the companions had brought with him to teach them with. It had the first verses of Surah Ta-Ha.
Later on as the revelations became bigger, the Prophet (ﷺ) and his companions took great efforts to preserve it through spending large portions of the night reciting. The Prophet (ﷺ) used to recite one sixth of the Qur'an in one raka'ah. The Prophet (ﷺ) made sure that each new Muslim had a teacher to teach him Qur'an so much so that he would send companions to other cities to make sure that Muslims in those cities were able to memorize. The companions were the ones who were preserved the memorization of the Qur'an, and it is only through them that the chains of narrations go back to the Prophet.
The Prophet (ﷺ) later on made sure that the Qur'an was written down and not just memorized, ensuring its preservation by checking whether it was written down correctly. During his time, 24 people became his scribes and among them was the four following khulafa and Zayd bin Thabit.
More than 15 companions were recorded to have written down most of the Qur'an. These were not complete copies of the Qur'an, however. For instance, Ibn Mas'ud had 106 surah's. The order of the surah's he had recorded was not the order we have today.
Also, Ubay ibn Ka'ab also had less than 114. Aside from the surah's he had, the prayer for qunut and a hadith were also found. Corrupt people who try to cast doubts on the legitimacy of the Qur'an use this to try to prove that these seemingly additions were actually 'verses' that were left out of the Qur'an, but it should be noted that because of the limited resources of writing material, these copies were personally used by the companions who owned them. On these, they also wrote personal notes aside from the Qur'an that they wished to retain in their memory. They were aware that these additions were not part of the Qur'an as they could have been notes on interpretation, dua'a, etc...
And it was the practice of the Prophet (ﷺ) to recite the Qur'an to the Angel Jibril every year, during the month of Ramadan. It was known that Jibril would also recite it back to him. The year that he died, the Prophet (ﷺ) recited the Qur'an twice to Jibril, and heard it from Jibril twice. During this last recitation, Zayd ibn Thabit was present.
The Prophet (ﷺ) made sure that the Qur'an was written down in its totality during his lifetime, but he did not order for it to be compiled in book form.
At the time, there was no pressing need to compile the whole Qur'an in one book, since the Qur'an was not in any danger of being lost. There were numerous Companions who had memorized all of it, and each Companion had memorized various portions of it. Likewise, it would not have been possible to compile all of it in one book, since it had not been completely revealed yet as the last verse was revealed only nine days before the death of the Prophet.
In addition, by the command of the Prophet (ﷺ) madinan verses could be placed in the midst of makkan verses, and vice versa. The arrangement of the verses and surah's was not chronological. Hence, the Prophet (ﷺ) could not have compiled the Qur'an in the correct order until all its verses had been revealed.
Fourth, there were some revelations that used to be a part of the Qur'an, but Allah abrogated their recitation. During the lifetime of the Prophet (ﷺ) this abrogation could occur at any time; therefore it was essential that these were terminated first before the Qur'an be compiled.
At the time of his death, the entire Qur'an had been memorized by many of the Companions, and existed in written form, but it had not been compiled in book form. In fact, it was spread in loose fragments that were owned by different people.
After the Prophet's death, during the khilafah of Abu Bakr (رضي الله عنه), seventy Companions who had memorized the Qur'an were martyred during the Battle of Yamamah. Their martyrdom alarmed 'Umar (رضي الله عنه) for they were such a large number of memorizers. He went to Abu Bakr and convinced him to compile the copies of the Qur'an. They both decided to give this responsibility to Zayd bin Thabit (رضي الله عنه). They chose Zayd because he was the primary scribe of the Prophet (ﷺ) among other reasons like being the one present during the last recitation of the Qur'an by the Prophet.
The strict criterion he applied ensured the authenticity of the compilation. For instance, even if he had memorized the entire Qur'an and could have written it from his own memory, he made sure that there were at least two other memorizers of the verse, and a written copy of the verse that was written under the direct supervision of the Prophet.
Almost two years after the death of the Prophet, when all of the major Companions were still alive, for the first time the Qur'an had been compiled. The written copy of the Qur'an was called a mushaf (meaning a collection of loose papers) and remained with Abu Bakr (رضي الله عنه) and, after his death, with 'Umar, then with Hafsah who was the daughter of 'Umar and the wife of the Prophet.
Ali bin Abi Talib (رضي الله عنه) was quoted to have said:
The person with the greatest rewards with regards to the (compilation) of the mushaf is Abu Bakr. May Allah's mercy be on Abu Bakr, he was the first person to compile the Book of Allah. (Qatan: Mubahith)
This compilation however was not meant to be an official copy that the whole ummah had to follow. It was meant only to preserve the Qur'an in its entirety.
After the death of Abu Bakr, the Muslims had expanded their territories under khilafah of 'Umar ibn al-Khattab (رضي الله عنه). After 'Umar's death, 'Uthman bin Affan (رضي الله عنه) became the khalifah. However, while the Muslims became successful in waging jihad fisabilillah, in the areas of Armenia and Azerbaijan, they started fighting amongst each other with regards to the recitation of the Qur'an. The Muslims from Syria also began debating with Muslims from Iraq as to whose recitation was more superior. These Muslims were not from the companions of the Prophet (ﷺ) and therefore did not have the proper etiquette in the recitation of the Qur'an. Uthman (رضي الله عنه) became alarmed at the news and consulted with the companions as to his plan of action to resolve this great problem with the Muslims. Upon this consulation, he decided official copies of the Qur'an from one official source should be written and sent to all the provinces while the rest of the other copies destroyed. The Muslim Ummah would then have one official standard Qur'an.
Ali ibn Abi Talib (رضي الله عنه) said about this:
O People! Do not say evil of 'Uthman, but only say good about him. Concerning the burning of the mushafs, I swear by Allah, he only did this after he had called all of us…
'Uthman (رضي الله عنه) borrowed the mushaf that Abu Bakr had ordered to be compiled from Hafsah (رضي الله عنه). He then chose a committee of four people: Zayd ibn Thabit, 'Abdullah ibn az-Zubayr, Sa'id ibn al-'Aas and 'Abd al-Qays to Basrah, to rewrite the mushaf of Abu Bakr, all of whom were chosen for their high merits. With the exclusion of Zayd, the three were purposely chosen from the Quraysh because the words were to be spelled in the dialect of the Quraysh since it was the dialect in which the Qur'an was revealed. At times of differences of opinions, scribes who wrote those said verses were called in to confer with them on the matter. Thereafter, 'Uthman ordered one copy of this mushaf to be sent to every Muslim province and ordered each governor to burn all existing copies. He sought unite the Muslims in the proper recitation of the Qur'an and to settle disputes within the Muslim Ummah. By this, he provided a copy of the Qur'an that would serve as a model onwards. Not only did he send an official copy, he likewise sent reciters to teach people the proper way of reciting.
Ali bin Abi Talib (رضي الله عنه) was quoted to have said regarding this event:
If I were in charge when Uthman had been, I would have done the same as he did. (az-Zarqani)
4] The study of an-Nasikh wal-Mansukh: Abrogated verses in the Qur'an.
Without going too much into detail, since this is a study in and of itself, there are verses in the Qur'an that abrogate, replace, or supercede each other. And this process involves previously existing Islamic rulings on the very same subject and later on abrogated by a later ruling. This must originate from the Qur'an and not from consensus (ijma') or analogy (qiyas). In short, it has its own conditions and rulings. Some examples are the verse of the sword, prohibition of alcoholic drinks, etc. For the most part, these verses do not go beyond 12. (ash-Shanqeeti)