I've read that some German Generals knew that defeat was inevitable quite early on, before the total retreat on the Eastern Front and the Red Army in Berlin, there was also the assassination attempts on Hitler like Valkyrie.
But what was seen as the turning point in WW2?
The Hossbach Memo is the most damning piece of evidence to support the argument that Hitler and his generals knew before the war even started that it couldn't be won. The memo records a meeting in November of 1937 in which the Reich Foreign Minister, Baron Konstantin von Neurath, the Reich War Minister, Field Marshal Werner von Blomberg, the Army Commander, General Werner von Fritsch, the Kriegsmarine Commander, Admiral Erich Raeder, and the LuftwaffeCommander, Hermann Göring all agreed that Germany's economy was in a state of crisis that could only be remedied by the seizure of raw materials from Austria, Czechoslovakia, and ultimately Poland.
However, Blomberg, Fritsch and Neurath (so the War Minister, the Commander of the Army, and the Foreign Minister; you'd think they'd have an idea of what they were talking about) all argued that Germany wasn't prepared for war and needed more time to rearm. The meeting had been called to discuss steel allocation, with the Kriegsmarine saying they were on the brink of collapse if they didn't get more (again, not a great sign if you plan to confront the British and French fleets simultaneously). Those three argued that trying to seize Austria, Czechoslovakia, and Poland would trigger a general war that Germany could not win in 1939 but might be ready to fight in 1942 or 1943. Hitler felt that French and British trade policies would collapse the German economy by that point. All three were removed and replaced by February of 1938.
So, horrifically enough, it's completely plausible that the German military leadership knew from the start they couldn't win and just shuffled people around until they found someone who was willing to go along with Hitler. Makes the death of tens of millions of people even more awful, if that's possible.
More can be written, but you might like to start with "At what point in WW II did the German military realize the war could not be won anymore and did how did they try to act on it?" . /u/vonadler gave the main replies, and /u/Abimor-BehindYou gave an important qualifier.
This is not to discourage discussion. More questions, data, and debate are welcome.