Lincoln Thinkin. Date Unknown.
To begin with, I think it's important to note that it's impossible to know the zeitgeist of the period these men, 300 years ago and on a different continent, lived in. Nor is it possible to claim knowledge of the individualized thought patterns of these brilliant, reclusive men. However, to the best of our abilities, we can try to draw parallels with cause-and-effect occurrences similar to those in our world and hope we can isolate particular motivations to construct a very basic, even skeletal, mindset.
The cause of the Kotzker's depression can be gleaned from the literature available. His father was overly critical and demanding of him. This would have, despite his intelligence, formed a low self concept, which would explain his drive for self-perfection, and complete truthfulness. I.e. since he was not allowed to practice and establish his own identity, he considered himself a fraud and was allergic to this fraud in himself - and others because of Projection. We do not know what the behavior of Nietzsche's parents were towards him so it is impossible to draw any parallels. However, it is noteworthy that he shared these traits with the Kotzker.
As it turned out, there was a lot of corruption and falsehood in "Litvish" and Chassidic Judaism in Poland at that time for the young Menachem Mendel to focus on as the general cause for his- and what he perceived as everyone else's- problem. Unfortunately, there was no place for individual dissent among religious Jewry at the time, especially from someone so young. As a young adolescent, however, he traveled to other communities to find more authentic, real Judaism. He ended up becoming a Chassid first of the "Seer of Lublin", then of his student, the "The Holy Jew", and finally of his student, R'Simcha Bunim, before starting his own Chassidus.
He chose only the sincerest, brightest young men to follow him, eschewing all physical pleasures, and focusing on authenticity, scholarship and bonding with God. He wrote no books, and in fact burned all of his personal writings. He wanted to lead by example, the most effective way in his opinion. As much as he felt he could impart of his ethos, this could be the only way. However, being in a position to instruct others as to the correct way of service to God did not make him happy. He and his students could never be perfect, though, and this inflamed his original trauma to the point of locking himself away because he couldn't take, in his words, "the stench" of falsehood in the world. In a poignant phrase uttered close to the time he locked himself away, he said, "Soon they will proclaim me to be a deity, but I am a broken and imperfect man."
Friedrich Nietzsche's situation allowed for a different turn of events. Through his schooling, he was shown an alternative to his small town, enclosed Christian-value life. He discovered respected thinkers, writers, and a whole world interested in iconoclastic thought. His Nihilistic ideas, unlike R' Menachem Mendel's rebellion against the status quo Judaism, although not followed, were respected. His Ubermensch idea was similar to R' M.M. idea for a free-thinking, rational, individual (granted the endgame of such a creature was totally different), but while his was considered the sign of a prodigious, creative mind, R' M.M.'s was dismissed by most as lunacy, and worse, heresy.
The reason for all this is that R' M.M. lived in a totally religious environment, where accepting a different interpretation for serving God meant having to change your life. Since R' M.M.'s ideas were so extremely ascetic and morally exacting, most people could not bear to seriously consider them. Nietzsche, on the other hand, published his ideas for an intellectual community; his word was not binding on anyone. As such, his ideas were studied by anyone with an intellectual bent, his brilliance became apparent, and his ideas gained respectability. This could be why R' M.M. didn't write, while Nietzsche did. R' M.M. was operating under a divine mandate to fix things now to bring the Messiah as soon as he could. (He constantly spoke of his role in relation to the Messiah. A few even claimed he thought of himself as it.) Nietzsche, however, could allow people to take their time to accept his ideas. He'd personally work towards his goal in the meantime, but there was no rush for others. The Overhuman can be thought of as an individualized Messiah, but not a communal one. It is possible that he realized that no matter how hard he tried, this ultimate salvation was unattainable for him, and suffered a mental breakdown. In both cases, unfortunately, the underlying problem of low self-esteem was never dealt with, resulting in tragedy.
Postscript: I understand that for some, breaking this down to somewhat utilitarian motivation would seem to denigrate the greatness of these people. But how can we ignore facts we are aware of? What use is it to pretend to learn false lessons from these great exemplars of humanity- both of them champions of truth? What lessons in humanity would we then actually be learning? While we are diminishing the importance of the role that free choice plays in all life, even great ones, we are by no means erasing it entirely. I think it is better to examine the facts thoroughly, and if the hallowed images fixed in our minds are shattered, it's no cause for worry. Other, more relatable images will take their places, and different, usually more practical, life lessons can be learned from them.
One good lesson we can learn is the effect people have without even knowing or acknowledging it. Life isn't going to go perfectly, but great things can be accomplished through gradual change as long as you keep at it, day after day. Another important lesson is that no matter how honest and intelligent you are, depression cannot be overcome through analysis alone. Therapy/ies are needed to erase or ease the childhood trauma. Another lesson is that gaining external validation, through followers or fame, also doesn't alleviate the problem of low self-esteem caused by childhood trauma.