I tried to translate for you the meaning of "endeavor", that means "a great effort, or an enterprise that one undertakes". The words "it doesn't matter what" are the translation of the word "any" in this meaning.
Maybe you know that "any" is the interrogative or negative of "some", but "any"of that sentence is another thing: there it means: "whatever", or "it doesn't matter what", thus "it's not important what kind of enterprise you undertake, the fact that perseverance is a key to success is always true for each enterprise you undertake".
Thus I could rewrite the sentence in this way:
"Perseverance is an always useful and fundamental thing to obtain success" (this is the "translation" of: "perseverance is a general key to success"), and this concept is always true for each enterprise you undertake in life, whatever it is (this is the "translation" of: "in any endeavor"), but perseverance is far from being common (that is to say: it's not common at all, it's not widespread at all), and it's not common especially among students, in the situations in which they are dealing with difficult problems".
"Any" in this case has the same meaning of "whatever", or "whatever it is". If you know the meaning of "whatever", you understand the meaning of this "any".