What Germany wanted to gain, or at least hoped to gain
To address the "naive" part: the Germans were at the brink of collapse –– much like as the Austrians –– and felt betrayed by the allies. The Germans felt they were also being tricked into the armistice negotiations as they developed.
The Germans thought that an honourable peace was on the horizon based on Wilson's 14 points. When the German delegation arrived at the railway car they were surprised to learn that the French and other allies really have led them into the woods (of Compiègne and figuratively). There were no negotiations to take place at all.
Despite the conditions expected by the German delegation when they initiated this exchange:

(German Foreign Ministry: Der Waffenstillstand 1918 - Faksimiles ausgewählter Bilder und Dokumente)
Although it is true that the notes exchanged in preparation for the armistice negotiations already took away a few of the German 'demands' – and hopes – The German delegation was still stumped on arrival:
Foch: „Was führt die Herren hierher? Was wünschen Sie?“
Erzberger: „Ich sehe Ihren Vorschlägen über die Herbeiführung eines Waffenstillstandes zu Wasser, zu Lande und in der Luft entgegen.“
Foch: „Ich habe Ihnen keine Vorschläge zu machen. Ich habe Ihnen keine Bedingungen zu stellen.
Meaning that despite German expectations, there would not be negotiations, only conditions to accept. Foch even declaring that negotiations were not only not granted but frankly "impossible".
Since by that time not only did the allies continue to press on, these were not only the sole factors for signing. Military exhaustion on the hand, allied advances on another, and rumours of peace talks on yet another made the seriously disgruntled German public and many soldiers further unwilling to fight – or die an even more senseless death.
The true morale of the troops of the other side were opaque to all involved.
What the Germans did gain
There was no question of negotiation. The Germans were able to correct a few impossible demands (for example, the decommissioning of more submarines than their fleet possessed), extended the schedule for the withdrawal and registered their formal protest at the harshness of Allied terms. But they were in no position to refuse to sign.
Being told to either sign or face the consequences they felt and were blackmailed into signing. No one with any responsibility was in favour of signing –– but except for hot heads that wanted to die in honour (like the navy command, the Kaiser and a few others) nobody came up with an alternative.
Wilson, thereby, agreed to the original German request. Nineteen days after the Germans sent him their First Note, Wilson was using his influence to bring about an armistice based on his Fourteen Points.[…]
Four days after Wilson sent his Third Note, the Germans responded that they awaited Allied proposals for an armistice.
Bullitt Lowry: "Armistice 1918", Kent State University Press, 2000, p 41.
But the Germans were also being tricked into signing by Ludendorff and the rest of the army. Ludendorff envisioned quite correctly that those democratic powers that wanted peace should also have their signature under the shameful armistice and peace treaties, in order to turn around the the real responsibilities. The military started the war and lost it, now they wanted to blame the civilians for all of it.
Sie forderte am 29. September 1918 von der Reichsregierung die sofortige Aufnahme von Waffenstillstandsverhandlungen mit dem Hinweis, dass die Front jeden Tag zusammenbrechen könne. In der Folge zog sich das Heer langsam zurück, und am 4. Oktober ersuchte die deutsche Regierung Woodrow Wilson, den Präsidenten der USA, um Waffenstillstandsverhandlungen. Dessen Vierzehn-Punkte-Vorschlag einer internationalen Nachkriegsordnung schien noch am ehesten eine Perspektive zu bieten.
Even after the dies ater the OHL told everyone that they were winning. When the OHL ordered democratic reforms on 29. Sep everyone civilian was surprised. After the Kaiser was abdicated Ebert was only halfway in a sort of office when the signatures were made. The delegation was largely clueless. A protracted war was still a possibility but they went into an expected negotiation that wasn't allowed by the French. In fact the army leadership mutinied on the overwhelmingly monarchist democrats and refused to continue fighting. The price obviously being much more dead on both sides.
On October 23 Wilson demanded in his third note beyond the previously agreed withdrawal of the German armies from the occupied territories as well as the cessation of the U-boat War the internal reconstruction of the German Reich and measures which should make a German resumption of fighting impossible. Ludendorff, who aspired to an armistice and "had not considered the political and military consequences of his sudden decision even in the beginning", now faced the demand for a German surrender, which he flatly rejected. At this point he therefore wanted to break off further negotiations and, in blatant contradiction to his previous steps, demanded a continuation of the "resistance with extreme forces". However, the current Max von Baden government did not support this course. On October 26, 1918, Ludendorff was - surprisingly for him - dismissed by the Emperor at Bellevue Palace at the request of the Imperial Chancellor, but formally at his own request.
WP Ludendorff
They gained just a few things: the killing stopped on the battlefield, and order was largely maintained. The revolutionary spark that was spreading from the "hell no, we won't go" sailors and among very few troops of the army could therefore be contained by the loyalist right wingers and monarchists within the army and the forming freikorps.
Thus the Germans could have two revolutions at once and none at the same time: one from above and one from below which canceled each others out, largely.
Am 29. September überzeugten Hindenburg und Ludendorff Kaiser Wilhelm II., dass angesichts der militärischen Überlegenheit des Gegners Deutschland den Krieg definitiv verloren habe. Die Verantwortung wollte die Oberste Heeresleitung jedoch nicht übernehmen, sondern die „Suppe sollen die essen“, wie Ludendorff sich ausdrückte, „die sie uns eingebrockt haben“. Gemeint waren damit die später als „Novemberverbrecher“ diffamierten linksliberalen, sozial- und christdemokratischen Politiker.
(Otto Langels: "Vor 85 Jahren formulierte Hindenburg die Dolchstoßlegende", Deutschlandfunk, 18.11.2004)
Yet another perspective that might run a bit counter to high school history:
The first German request was sent to President Wilson on 4 October, and five weeks later the Armistice was signed in a railway carriage near Rethondes in the Compiègne forest. The date and the time of that signing have been commemorated annually ever since as marking the end of the war. Yet the armistice agreement was not intended to end the war but to call a truce; it merely caused the weapons to fall silent. That is why the German term – the silencing of weapons – is used for the title of this chapter, rather than the sometimes misinterpreted English/French term.
At OHL headquarters in Spa, the news that on 25 September Bulgaria had requested an armistice, coupled with the start of Foch’s general offensive in Belgium and France, caused Ludendorff’s physical collapse. His increasing pessimism had already alarmed some OHL staff, who decided on 26 September to call Foreign Minister Paul von Hintze to Spa to discuss the situation. Three days later Hintze and the Kaiser met with Hindenburg and Ludendorff and were told that an immediate Waffenstillstand was required to save the army, and that political reform was required to make the country accept it. Ludendorff was convinced that the worsening military situation in both east and west demanded an immediate armistice, but not peace negotiations. If the armistice conditions were too hard, he was prepared to fight on. In conference with the OHL section leaders on 1 October Ludendorff informed them that, to avoid the ‘catastrophe’ of an Allied breakthrough forcing the army back to the Rhine and bringing revolution to Germany, an immediate Waffenstillstand was necessary, based on Wilson’s Fourteen Points. He told Thaer that ‘unfortunately’ he saw ‘no other way’. However, when Thaer asked Ludendorff whether he believed that the Allies would grant it, and whether, if he were Marshal Foch, he himself would grant such an armistice, Ludendorff replied: ‘No, surely not, rather first grab the opportunity [to gain a breathing-space by requesting an armistice]’. Yet perhaps, he continued, the Allies wanted it: ‘in war one can never know’.
Ludendorff pressed Berlin several times during the next few days to hasten the formation of a new government (he and Hindenburg approved the appointment of Prince Max von Baden as the new Chancellor on 30 September), but the true military situation took some time to sink into the new minds in Berlin. OHL had kept both politicians and the German people in the dark, hence the shock when the Ludendorff–Hindenburg duo requested that the government negotiate an armistice. Consequently it was only on the night of 3/4 October that the German government’s note was sent via Switzerland to President Wilson. It asked for the USA to take steps to restore peace, and also ‘in order to prevent further bloodshed’ to arrange a ‘general armistice on land, on water and in the air’. The note was thus not only a request for an armistice, but also for negotiations for a Wilsonian peace – a peace that they believed would give them more generous terms than the Entente leaders would offer.
There is no need to go into the Allied negotiations that led to Rethondes, as they have been well described elsewhere. What is important here is Foch’s attitude and his resultant decisions. They form the background to the first two stages of the negotiations in which Foch played only a small formal role. The first stage, following this first German note, consisted of the ensuing correspondence between Germany and President Wilson, in which it was agreed finally that Germany would approach Marshal Foch to ask for terms based on Wilson’s Fourteen Points. The second (international) stage lasted from 29 October, when the bilateral USA–Germany phase ended, to 4 November when the Allies meeting as the SWC agreed the terms after much discussion. During this second stage Foch talked with Pétain, Haig and Pershing, but essentially it was his terms that formed the basis of the agreed military terms that were offered. The third and final stage covers the days leading up to the signing, when Foch’s role was central.

Elizabeth Greenhalgh: "Foch in Command
The forging of a First World War general", Cambridge University Press: Cambridge, New York, 2011, pp464.
The leader of the German delegation to Compiègne summed up all of the above nicely, when he signed the paper:
A people of 70 million suffers, but does not die.
And as later events seem to prove, the country of Germany survived, its conservative elites survived, their nationalist spirit and aggressive militarism survived as well.