Executive summary : France lost World War II, but De Gaulle eventually won it.
When I was a child, here in France, I learnt that the Allies won World War II, and that France was one of them. Later, I thought a little more about it, and concluded that France had actually lost the war, since the country surrendered very quickly in 1940, and collaborated with the Nazis afterwards. What was the truth? The truth was that there was not one France then, but two:
At the beginning, Roosevelt decided to recognize Pétain as the legitimate French leader, and even to work with Vichy in order to keep it from collaborating even more with the Germans. A few days before the landing in Normandy (June 6, 1944), Roosevelt still wanted to establish in France the same kind of military government as the one which was to be installed in Germany. But, during these years, owing to his action in the French colonies and his speeches at the BBC, de Gaulle had managed to be accepted as the leader of free France by most French refugees abroad as well as by the French resistance and all the people who simply waited for the Allies to liberate the country.
Even Churchill supported de Gaulle because he thought a strong France was necessary for the European geopolitical equilibrium. Nevertheless, Roosevelt never really admitted de Gaulle's leadership on French issues. For him, the most important thing was to win the war, at any price. Massive American bombings in 1944 destroyed a lot of cities in Northern France and probably killed more civilians than the German invasion in 1940. This is another fact that the schoolbooks barely mention.
Because of Roosevelt's opposition, de Gaulle was not present at the Yalta conference (February 1945), but Churchill obtained that an occupation zone in Germany be allocated to France. In April, Roosevelt died, and France eventually received a seat at the UNO Security Council.
So, at the end of the war, because of his charisma and vision, and with Churchill's help, de Gaulle's France appeared to be the real France, at least in the eyes of the Frenchmen, and de Gaulle was recognized as the natural leader although he had not been elected yet. And the same country that had been defeated five years before was now considered as one of the winners.
My teachers at school were technically true. They only exaggerated a few events like the liberation of Paris (which was done by Frenchmen because Paris was not strategically important for the Americans), and they did not insist very much about the extent of the collaboration.