The following is taken from the lesson in the Tanya taught by Rabbi Joseph Gordon. This is mixture of my words and direct quotes from the Rabbi and the Tanya with footnotes.
“Tzaddik” is a person who has eradicated his evil inclination. He doesn’t function out of lust or ego or self-serving. Very people have achieved this…
These rare people do the right thing for this is what HaShem wants us to do.
“David extirpated his evil nature through fasting; other ways too are possible.
We thus see from the Gemara that the definition of tzaddik in its true sense applies to the person who has rid himself of his evil nature.
But whoever has not attained this degree of ridding himself of his evil nature, even though his virtues outnumber his sins, is not at all at the level and rank of tzaddik”. 2.Tehillim 109:22. See ch. 13 for the comment of the Rebbe on the interpretation of this verse
“Thus, in each generation there must be a tzaddik who serves as the “foundation of the world.”
“This paucity of tzaddikim (“The righteous were few”) can be explained only if a tzaddik is he who has totally rid himself of his evil nature. Were the term tzaddik to mean one whose good deeds outweigh the evil, why then do our Sages say that “the righteous were few,” when the overwhelming majority of Jews have more good deeds than evil!” 1. See Rambam, Hilchot Teshuvah 3:1; Rashi on Rosh HaShanah 16b.
David sinned and then repented so hard that he removed the negative in heart so he became one with G-d. David killed the evil within him by constant fasting and prayer. David sought G-d and created a vacuum in his heart.
My prayer is become like David and get rid of all of the evil with me so I just serve with G-d with no hidden motives.
“As for the well-known saying1 that one [whose deeds and misdeeds are] equally balanced is called a Beinoni, while [he who has] a majority of virtues outweighing his sins is called a tzaddik.” 1. See Rambam, Hilchot Teshuvah 3:1; Rashi on Rosh HaShanah 16b.
I am a Beinoni. I pray to HaShem to make me clean and get rid of my self-centeredness so I can serve HaShem with pure motives.