Assalamualaikum w.b.t. Is my prayer valid if I give the salam to my right twice because I wanted to correct my salam recitation because I made a mistake the first time?
Alhamdulillah, praise and gratitude to Allah SWT for His countless blessings for us all. Praise and salutations to our beloved Prophet Muhammad PBUH, his family, companions and all those who follow his footsteps until the Last Day.
Basically, a valid and complete prayer is one that fulfils all of its requisites and conditions. Requisites are the basis of a certain matter. For example, the walls of a room. Hence, the parts of prayer consist of specific requisites. Prayer will never be complete and is invalid if one didn’t fulfil all of its parts following the methodology and order that comes from Rasullullah PBUH as he received it from Gabriel AS. All of the requisites of prayer can be summarized into 13 matters. 
Coming back to the question asked, giving the first salam is included in the qauliyyah requisites of prayer. It is named qauliyyah because it is conditioned for a person praying to recite it loud enough that he can hear it himself.  Furthermore, giving the first salam is obligatory based on a narration from Ali bin Abu Talib RA, Rasullullah PBUH said:
مِفتاحُ الصَّلاةِ الطُّهورُ، وتحريمُها التَّكبيرُ، وتحليلُها التَّسليمُ
“The key of prayer is purification, saying ‘God is most great’ makes it a sacred state, and the salutation brings the sacred state to an end.” 
Imam al-Nawawi when commenting on the above hadith concluded that giving salam is one of the requisites of prayer. A prayer is invalid except when it is performed and none can take its place – which means replace it. The least that one should recite for the salam is “السَّلَامُ عَلَيْكُمْ”. If any one of the letters is missed, then his salam is invalid.  The simplest salam is to recite “السَّلَامُ عَلَيْكُمْ” once and the best recitation is “السَّلَامُ عَلَيْكُمْ وَرَحْمَةُ اللَّهِ” recited twice; the first when turning to the right and the second while turning to the left.  This follows a narration from Sa’ad bin Abu Waqqas RA, he said:
كُنْتُ أَرى رَسولَ اللهِ ﷺ يُسَلِّمُ عن يَمِينِهِ، وَعَنْ يَسارِهِ، حتّى أَرى بَياضَ خَدِّهِ
“I saw the Messenger of Allah (may peace be open him) pronouncing taslim on his right and on his left till I saw the whiteness of his cheek.” 
As for giving salam with the recitation “عَلَيْكُمُ السَّلَامُ”, according to scholars of madhhab Syafi’I, it is accepted but makruh. 
Invalid recitations of salam
If a person gives salam by reciting “السَّلَامُ عَلَيْهِمْ”, it is invalid but his prayer isn’t invalidated, for it is a supplication for a third party. Whereas, if he uses other recitations such as “السَّلَامُ عَلَيْكَ” or “سَلَامِي عَلَيْكَ” or “سَلَامُ اللَّهِ عَلَيْكُمْ”, all of them is invalid. If he did so unintentionally, his prayer is not invalid but it is obligatory for him to repeat the correct and sabit salam. If he recited such phrases intentionally, then his prayer is invalid.
As for giving salam by reciting “سَلَامٌ عَلَيْكُمْ” where it is recited with a tanwin on the letter mim, scholars in madhhab Syafi’I have differing opinions and they are divided into two opinions:
The first opinion stated that the salam is invalid. This is the chosen opinion of Imam Nawawi and agreed by Syeikh Abu Hamid, al-Bandaniji, Qadi Abu al-Tayyib and most scholars in madhhab Syafi’i. Furthermore, Syeikh Abu Hamid and Abu Ishaq al-Marwazi cited that it is the opinion of Imam al-Syafi’i. They argued by presenting a narration from Malik bin al-Huwairith RA, he said:
أَتَيْنَا النَّبِيَّ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ، وَنَحْنُ شَبَبَةٌ مُتَقَارِبُونَ، فَأَقَمْنَا عِنْدَهُ عِشْرِينَ لَيْلَةً، فَظَنَّ أَنَّا اشْتَقْنَا أَهْلَنَا، وَسَأَلَنَا عَمَّنْ تَرَكْنَا فِي أَهْلِنَا، فَأَخْبَرْنَاهُ، وَكَانَ رَقِيقًا رَحِيمًا، فَقَالَ: ارْجِعُوا إِلَى أَهْلِيكُمْ، فَعَلِّمُوهُمْ وَمُرُوهُمْ، وَصَلُّوا كَمَا رَأَيْتُمُونِي أُصَلِّي، فَإِذَا حَضَرَتِ الصَّلاَةُ، فَلْيُؤَذِّنْ لَكُمْ أَحَدُكُمْ، ثُمَّ لِيَؤُمَّكُمْ أَكْبَرُكُمْ
“We came to the Prophet (ﷺ) and we were (a few) young men of approximately equal age and stayed with him for twenty nights. Then he thought that we were anxious for our families, and he asked us whom we had left behind to look after our families, and we told him. He was kindhearted and merciful, so he said, “Return to your families and teach them (religious knowledge) and order them (to do good deeds) and offer your prayers in the way you saw me offering my prayers, and when the stated time for the prayer becomes due, then one of you should pronounce its call (i.e. the Adhan), and the eldest of you should lead you in prayer.” 
Furthermore, sahih hadiths have explained to us that the Prophet PBUH gave salam with the phrase “السَّلَامُ عَلَيْكُمْ” and none states he ever recite the phrase “سَلَامٌ عَلَيْكُمْ”.  Moreover, Imam al-Nawawi also stated that if one makes a mistake – which means he recited a wrong recitation for his salam – then his prayer isn’t invalid, but is incomplete until he repeats it with the correct recitation. 
Imam al-Nawawi also said that if one gives salam – with invalid recitation for salam unintentionally – then his prayer isn’t invalid but it is sunnah to perform the sahwi prostration and obligatory to repeat the salam with the correct recitation.  The reason is the ruling for sahwi prostration is sunnah when there is a reason that permits it. The methodology for it is when one mistakenly recites the salam incorrectly, then he should first perform the sahwi prostration and then repeat his salam correctly because the sahwi prostration should be performed at the end of the prayer after the recitation of the final tasyahhud and the Ibrahimiyyah praise and salutations before the salam. 
According to the above arguments and discussion, in our opinion, if a person intentionally gives the first salam with an invalid salam recitation, then his prayer is invalid. However, if he made a mistake in reciting it, then his prayer isn’t invalidated but it is obligatory for him to repeat it with the correct and sabit salam.
Likewise, it is also sunnah for anyone who made a mistake or unintentionally recite an invalid salam to perform the sahwi prostration as stated by Imam al-Nawawi and the sahwi prostration should be performed at the end of the prayer which is after the final tasyahhud and Ibrahimiyyah praise and salutation recitation before the salam.
May Allah SWT grant us all a clear understanding in this religion. Ameen.
 See al-Fiqh al-Manhaji, 1/141.
 See al-Taqrirat al-Sadidah, pg. 208.
 Narrated by Abu Daud (61); Ibn Majah (275); Ahmad (1006); al-Tirmizi (238) and al-Albani evaluated it as sahih.
 See al-Majmu‘ Syarh al-Muhazzab, 3/475-476.
 See al-Fiqh al-Manhaji, 1/141; al-Mu‘tamad fi al-Fiqh al-Syafi‘I, 1/300; Mughni al-Muhtaj, 1/385; Raudhah al-Talibin, 1/267-268.
 Narrated by Muslim (582)
 See Tuhfah al-Muhtaj, 2/90; Raudhah al-Talibin, 1/267; al-Majmu‘ Syarh al-Muhazzab, 3/476; al-Azkar, pg. 148.
 Narrated by al-Bukhari (6008)
 See al-Majmu‘ Syarh al-Muhazzab, 3/476; Mughni al-Muhtaj, 1/385; Raudhah al-Talibin, 1/267.
 See al-Azkar, pg. 149.
 See al-Majmu‘ Syarh al-Muhazzab, 3/476.
 See al-Mu‘tamad fi al-Fiqh al-Syafi‘i, 1/336-337.