Why did Dönitz take over running Germany?

Admiral Karl Dönitz was chosen to lead Germany after Hitler's death due to his fierce loyalty and the elimination of other potential successors. During his brief leadership, Dönitz aimed to ensure as many Germans as possible surrendered to the Western allies rather than the Soviets. His strategy involved ordering German armies in the West to surrender and those in the East to fight to the end. However, this plan was unsuccessful, and Dönitz was eventually forced to surrender unconditionally to the Allies.

via Why did Doenitz take over running Germany? (Short Animated Documentary)