Is it valid to retract a vow?
Question

I am a student and I asked Allah to let me get first place in my class, and I vowed that if I achieved that, I would fast on a specific day, which is Thursday. Before I started the second half of the year, before the results were known, I found out that the school would announce who was first in the school, not in each class, so I retracted my vow. Now I would fast on the same Thursday if I got first place in the school, not in the class. 
The results came out and I got second place in the school, and first place in the class. Hence I did not fast on that day, because I did not get first place in the school.  
Am I sinning in this case? What should I do?.
Praise be to Allah.Your vow that if you got first place in your class, you would fast that Thursday, is an act of worship that must be fulfilled when the condition for it is met. As you came first in your class, you have to fast for a day as you vowed to do, because the Prophet (peace and blessings of Allah be upon him) said: “Whoever vows to obey Allah, let him obey Him.” Narrated by al-Bukhaari (6318). 
It is not acceptable to retract a vow, because of what we have stated above about it being obligatory to fulfil it, and because ‘Umar (may Allah be pleased with him) said: “Four things are binding in every case: manumission, divorce, marriage, and vows.” Narrated by Ibn Abi Shaybah in his Musannaf (4/82). And it was narrated that ‘Ali (may Allah be pleased with him) said: “There are four that cannot be retracted and must be fulfilled: marriage, divorce, manumission and vows.” This was quoted by Ibn Hazm in al-Muhalla (8/197). 
See: al-Mawsoo’ah al-Fiqhiyyah (7/267). 
Your second vow has to do with the placing in the school; you do not have to do anything because the condition was not fulfilled. 
Based on this, if you vowed that you would fast on any Thursday, then you must fulfil the vow. 
If you vowed that you would fast a specific Thursday and it has passed, then you have to make up this day and fast on another Thursday, and you also have to offer expiation for breaking an oath (kafaarat yameen), because you did not fast on the day that you specified for fasting. 
Al-Mardaawi said in al-Insaaf (28/212): 
If he vowed to fast a certain month and he did not fast it with no excuse, then he has to make it up and also offer expiation for breaking an oath – and there is no difference of scholarly opinion on this point. If he did not fast it due to an excuse, then he has to make it up – and there is no difference of scholarly opinion on this point – but there are two opinions narrated from Imam Ahmad with regard to expiation. Our view is that he also has to offer expiation, and this was regarded as the correct opinion by Ibn Qudaamah and others. End quote. 
You should note that making vows is makrooh, although it is obligatory to fulfil them, because of the report narrated by al-Bukhaari (6608) and Muslim (1639) from Ibn ‘Umar (may Allah be pleased with him) who said: The Prophet (peace and blessings of Allah be upon him) told people not to make vows and said: “They do not avert anything, all they do is get something out of a stingy person.” 
And Allah knows best.