Hashem said to Moshe, "When you will raise the head of Bnei Yisrael (Shemos 30:11,12)." The verse (Tehilim 3:3) "Many say of my soul, 'There is no salvation for him from Hashem forever'" speaks of the nations of the world who say, "A nation that heard at Sinai, 'I am Hashem your G-d, you shall not have other gods' (Shemos 20:2,3), and forty days later said 'These are your gods, Yisrael' (32:4), can they have salvation? There is no salvation for him [Yisrael] forever!" But You, Hashem, are a shield for me, the One who raises my head (Tehilim 3:4); we were guilty of a capital offense punishable by severing of the head, but You protected us and instead raised our head through Moshe as it says, "When you will raise the head"
- Tanchuma 4
Am Yisrael was despondent after committing the sin of idolatry a mere forty days after kabolas HaTorah. The nations scoffed at us, predicting that we could never be saved. Yet, after our precipitous decline from the highest spiritual point in our history to the depths of sin and despair, Hashem, through Moshe, raised our heads. He commanded us to build the Mishkan, using our shekalim to achieve atonement for our sins, including the Golden Calf.
The Tanchuma interprets the pesukim in Tehilim as referring to the personal sin of David Hamelech as well.
Many (Do'eg and Achitofel) say of me, "One who captured the sheep and killed the shepherd (i.e. who married Batsheva and killed her husband Uriah and Am Yisrael by the sword of war), can he be saved from his son Avshalom (Tehilim 3:1)? There is no salvation for him (David) forever!" But You, Hashem, are a shield for me, in the merit of my ancestors, as You said to Avraham, "I am a shield for you" (Bereishis 15:1). I was guilty of an offense punishable by severing of the head, but You raised my head through Nossan the prophet. When I said, "I have sinned to Hashem" he said "So, too, Hashem has set aside your sin, you shall not die" (Shmuel II, 12:13).
David Hamelech was undoubtedly devastated when he recognized and confessed to the enormity of his sin. His enemies were certain that his punishment, the rebellion of Avshalom, would be fatal. But Hashem protected David from Avshalom and restored his kingdom. His confession granted atonement for his sin and He merited an eternal dynasty.
David was not in a state to sin with Batsheva, as it is written (Tehilim 109:22) "My heart, i.e. my evil inclination, has died within me. Am Yisrael were not in a state to sin by worshipping the Golden Calf, as it is written (Devarim 5:26) "Would that their hearts be theirs to fear Me and observe all My commandments forever." Then why did they in fact sin? So that if an individual sins we tell him to learn from David; if the community sins we tell them to learn from Am Yisrael. Hashem decreed that they sin and repent to demonstrate that repentance is always possible (Avodah Zarah 4b, 5a, Rashi).
Am Yisrael was guilty of idolatry and David's sin bordered on immorality and murder. If teshuva is effective for the three cardinal sins for which one must give up his life, it can certainly atone for lesser sins.
When a person sins, the yetzer hara says to him, "Your situation is hopeless. There is no point in attempting to correct your mistake. Since you rare spiritually doomed, continue in your sinful ways and enjoy life. You have nothing to lose." Parshas Ki Sisa combats this insidious notion. The Tanchuma (3) interprets Ki Sisa in the future tense. When we read it every year, it is as if Moshe stands there and raises our heads. The eternal lesson of the atonement for the sin of the Golden Calf is that no situation is hopeless!
Every person has moments of spiritual angst. Some commit serious sins, others commit lesser ones. Many realize that they are not davening and/or learning Torah properly. Most recognize that they are not actualizing their full potential, neither in serving Hashem nor in helping others. The Satan says "It is too late to change or improve." When this happens we must remember the timeless message of Ki Sisa. In the absence of prophecy, we must, with the help of our spiritual leaders, lift up our own heads. Despair is a tool in the arsenal of the yetzer hara, and must be avoided in all circumstances.
Individually, we must emulate David; collectively we must emulate Am Yisrael who atoned for their grievous sin by building the Mishkan with their shekalim. By overcoming the yetzer hara and lifting our heads, may we speedily merit the coming of Mashiach ben David and the rebuilding of the Bais Hamikdash.