Shulchan Aruch (581) brings the custom to fast on erev Rosh Hashanah. The Chasam Sofer (printed in many Shulchan Aruchs) adds that people who study Torah don't generally fast on erev rosh chodesh, because their fasting would result in them being weak and learning less Torah. Nevertheless, he writes, on erev Rosh Hashanah, even the Torah scholars are accustomed to fast, ש"ית המלך פני לקבל, to greet the face of the King, blessed be His name."
the middle-level Yidden fast, and Hashem pardons another third. On Yom Kippur, when everyone fasts, Hashem forgives the Jewish people entirely."
Shulchan Aruch (581:2) discusses this fast, as it states, ּׁ ָנָההַש רֹאשׁ עֶרֶב לְהִתְע ַנּוֹת נוֹה ֲגִים, "The custom is to fast on erev Rosh Hashanah."
The question is that the Midrash (quoted in the Tur) states that tzaddikim fast on erev Rosh Hashanah. Why then does it mention here, that today, everyone fasts?
The Chasam Sofer (Drashos 11, ב"תקצ) answers that in the past, Hashem came to judge us, and in our times, Hashem comes to help us. Like in the mashal stated in the Midrash, when a king comes to demand taxes, it is proper that leading officials from the city should go out to speak to the king, and try to lower the taxes. But there are times when the king comes to help others, such as when he visits the ill in the hospital. At such times, those who are suffering the most should come forward to plead before the king for his help. In our times, Hashem doesn't come to judge us, because He knows we will be found unworthy, and Hashem doesn't want the destruction of the world. Therefore, Hashem comes to help us. Therefore, everyone fasts on erev Rosh Hashanah, not only the tzaddikim. In our times, every person can plead, and Hashem will save them.
The Chasam Sofer said that this is the meaning of the words we say in Selichos, לך הצדקה 'ה, Hashem comes to do kindness with us, therefore, לפניך באנו במעשים ולא בחסד לא, it isn't solely the tzaddikim who come before You. דלתיך דפקנו וכרשים כדלים, we come to Hashem like poor people, begging for help. Therefore, יבאו בשר כל עדיך תפילה שומע, everyone can come forward to pray to Hashem.
These ideas give us chizuk because we understand that the process of judgment has changed in our days to one of compassion. In addition, this lesson reminds everyone of his obligation to do his part to plead to Hashem for a good year.