The Torah tells us that after Moshe Rabbeinu descended from Har Sinai, smashed the Luchos, and had many of those who had served the now-destroyed Eigel HaZohov executed, he went back up to Hashem and davened to Him, asking Him to forgive the people for committing this terrible sin (שמות ל"ב:ל"א-ל"ב). According to Ibn Ezra (לפסוק י"א שם בד"ה ויחל משה), the Tefillah recorded earlier in the Parsha (שם פסוקים י"א-י"ג) was actually what Moshe recited at this point; this would appear to be the implication as well of the Pesukim later in the Torah (דברים ט':כ"ה-כ"ט) which describe Moshe's Tefillah following the destruction of the Eigel as containing strikingly similar words to the ones recorded earlier in this Parsha (שמות שם). The Ramban, however (לשמות שם פסוק י"א), insists that there were actually two separate Tefillos recited by Moshe; the first, described earlier in this Parsha (שם פסוקים י"א-י"ג), was recited when Moshe was still up on Har Sinai, before he saw and destroyed the Eigel, and just after Hashem said that He would destroy Bnai Yisrael, while the second, described subsequently (שם פסוקים ל"א-ל"ב), was recited after he had come down, reacted to the Eigel, and then went back up to Hashem. In any case, it is clear that Moshe Rabbeinu returned to Hashem and davened for the forgiveness of all of Bnai Yisrael after the Eigel was destroyed and many of the main perpetrators of the sin were killed.
According to the Pesukim later in the Torah (דברים שם פסוקים י"ח,כ"ה, ועיין ברש"י לפסוק כ"ה שם), Moshe davened to Hashem at that point for forty days and forty nights; Rashi (לפסוק י"ח שם) indicates that Moshe was up on Har Sinai for that entire period of time, starting on the 18th of Tammuz, and concluding on the 29th of Av, at which time Hashem reconciled Himself with Bnai Yisrael and forgave them. Rashi in our Parsha (שמות ל"ג:י"א בד"ה ושב) also states that Moshe was on Har Sinai for those forty days asking for Hashem's mercy, and he gives a detailed chronology of the significant events that transpired at that time. It is also clear from the Midrash Tanchuma on our Parsha (אות ל"א) that Moshe spent those forty days on Har Sinai, and it appears that this position is accepted by Tosafos in Bava Kamma (דף פ"ב. בד"ה כדי). According to the Pirkei DeRabbi Eliezer (פרק מ"ו), however, Moshe was actually in his tent in the camp when davening to Hashem for those forty days, an idea based, apparently, on other Pesukim in our Parsha (שמות שם פסוקים ז'-י"א); the Ramban, though, in his commentary on one of those Pesukim (פסוק ז' שם), rejects this view, noting that it seems to go against the simple understanding of the Pesukim later in the Torah (דברים שם), and the Rosh in Rosh HaShanah (פרק ד' סוף סימן י"ד) writes that there must be an error in the text of the Pirkei DeRabbi Eliezer (שם), and that Moshe was certainly on Har Sinai for those forty days. The Radal, however, in his commentary on the Pirkei DeRabbi Eliezer (שם אות י"ג ובהגהות שם אות ה'), defends this position, answering the questions raised by the Ramban (שם), and noting that the Vilna Gaon, in his commentary on the Torah (ספר אדרת אליהו לפ' כי תשא בד"ה ומשה) and elsewhere, accepted it as well, bringing a proof from a statement in the Tanna DeBei Eliyahu (סדר אליהו זוטא, פרק ד'), although the current standard version of that statement reads differently than as he quotes it. Regardless, though, of where Moshe Rabbeinu was, he certainly davened to Hashem for forty days, asking Him to forgive Bnai Yisrael for their sin.
As alluded to above, Moshe Rabbeinu, later in the Torah (שם), recounts to Bnai Yisrael his having davened to Hashem for forty days and forty nights; he uses there the word "ואתנפל," "and I threw myself down," to describe his particular style of prayer. Elsewhere in the Torah (שם פסוק ט'), Moshe uses the word "ואשב," "and I sat," to describe his stay on the mountain for forty days and forty nights, and in yet another place (שם י':י'), he says "ואנכי עמדתי," "and I stood," to describe his stay on the mountain. The Avudraham (סדר שחרית של חול ופירושה, עמוד קי"ט), making reference to these three descriptions, indicates that when we daven to Hashem daily, we consequently assume each of these three postures during the course of our Tefillos: we sit when reciting the Pesukei DeZimra (and other Tefillos prior to the Shemoneh Esrei), we stand when reciting the Shemoneh Esrei itself, and then we "fall on our faces," putting our heads down for the Tefillah known as Nefilas Apayim (נפילת אפים), which literally means putting down the head or face, and is more popularly referred to as Tachanun. The Avudraham (שם) adds that towards the end of this Tefillah, we recite a phrase from a Posuk in Divrei HaYomim Beis (כ':י"ב) which begins with the words "ואנחנו לא נדע מה נעשה," indicating that we do not know what to do, because we have already approached Hashem in every manner and position used by Moshe Rabbeinu at Har Sinai, and we thus state at that point that we do not know of any other way to daven. The Tur (אורח חיים סימן קל"א) likewise writes that at the end of this Tefillah, we recite this phrase because we have davened in every manner possible, namely, by sitting, by standing, and by putting our faces down, and we thus express that we have no ability to daven in any other way. The Aruch HaShulchan (שם סעיף א') says this as well, also writing that we put down our heads for Tachanun in order to have davened in three different positions, based on the above sources in the Torah, namely, sitting until the Shemoneh Esrei, standing during the Shemoneh Esrei, and then falling on our faces afterwards. The Mishnah Berurah (שם ס"ק ט') adds that it is proper to be sitting when reciting the words "ואנחנו לא נדע," and then to stand before continuing with the words "מה נעשה;" he also discusses the three different postures for Tefillah suggested by the above cited Pesukim about Moshe Rabbeinu.
The Gemara in Bava Metzia (דף נ"ט:) speaks about the tremendous effect that a prayer which is recited when putting one's head down can have; the Shittah Mekubetzes there (שם בד"ה לא) quotes from the Ritva that this is a reference to the Tefillah of Nefilas Apayim, which we call Tachanun, and he then adds that it is prohibited to interrupt between the Shemoneh Esrei and Tachanun with any conversation or other activity unrelated to davening. The Beis Yosef, in his commentary on the Tur (שם בד"ה ולאחר), notes that it is clear from several places in the Gemara that one should put one's head down and daven immediately after reciting the Shemoneh Esrei, and he then states (שם בד"ה וכתבו) in the name of the Rashba, referring to that same Gemara (ב"מ שם), that one should not talk at all between the recitation of the Shemoneh Esrei and the recitation of Tachanun, adding that if one does interrupt between these two Tefillos with other matters, one's davening will not be as readily accepted. He concludes (שם) that Tachanun, together with the Shemoneh Esrei, is like a תפלה אריכתא, one long Tefillah. The Shulchan Aruch (שם סעיף א') thus rules that one may not talk in between the Shemoneh Esrei and Tachanun. The Magen Avraham (שם ס"ק א') writes that it appears from other sources that it is not necessarily so terrible to talk at that point; this is also the position of the Shulchan Aruch HaRav (שם סעיף א') who writes that strictly speaking, there is no prohibition to talk at that point, since ultimately, this entire Tefillah is essentially optional, as pointed out as well by the Tur (שם) in the name of one of the Geonim, although it appears that the Rambam (פרק ה' מהל' תפילה הלכה א',י"ג) disagrees, and thus one need not be concerned about having an insignificant conversation at that time. The Kaf HaChaim (שם אות א'), however, quotes those who say emphatically that there should be no interruption at all between the Shemoneh Esrei and Tachanun, and the Aruch HaShulchan (שם סעיף ג') writes that while there can be no actual prohibition to speak then because Tachanun is fundamentally an optional Tefillah, it is nonetheless proper not to talk at that point, because if one does, the result of his recitation of Tachanun will not be what he wants it to be. The Shaarei Teshuvah (שם ס"ק א'), however, notes that one may answer to Kaddish or Kedushah or Borechu at that point; the Pri Megadim (במשבצות זהב שם ס"ק א') and the Mishnah Berurah (שם ס"ק א') appear to concur, but the Kaf HaChaim (שם אות ב') discusses more precisely which public aspects of davening one may participate in between the Shemoneh Esrei and Tachanun.
The Aruch HaShulchan (שם סעיף ד') writes that the true requirement of Nefilas Apayim is to spread one's hands and feet on the ground with one's head actually touching the ground, as is the common practice at certain points in the davening on Yom Kippur; the Shulchan Aruch HaRav (שם) makes a similar statement. The Mishnah Berurah (שם ס"ק ב') also writes that at one time, people did the real Nefilas Apayim, meaning that they literally put their faces to the ground, but that now the custom is not to do that, but rather to tilt the head a little and to cover the face. He also adds (שם) that one should cover one's face with a garment when reciting Tachanun, and not simply with the bare skin of the arm on which one is leaning, because the arm is a part of the same body, and one part of the body can not serve as a covering for another part of that body, as noted as well by the Magen Avraham (שם ס"ק ב'). It would thus seem to be preferable to wear a long-sleeve shirt or a jacket in order to cover the arm on which one will lean one's head during Tachanun.
The Sefer Rokeiach (סימן שכ"ד) writes that it is proper to put one's face down for Tachanun only in the presence of a Sefer Torah, as hinted at by a Posuk in Yehoshua (ז':ו') which connects falling on one's face to the Aron of Hashem; the Beis Yosef (שם בד"ה כתב עוד) quotes this view and then says that it can be challenged, but he does not elaborate. The Taz (שם ס"ק ה') does elaborate, however, explaining that there really is no proof from that Posuk (שם), and that there seem to be other situations where Nefilas Apayim is done even without a Sefer Torah being there. The Aruch HaShulchan (שם סעיף י') explains even more simply that the whole idea of Nefilas Apayim is learned from the practice of Moshe Rabbeinu, as described above, and since there was no Sefer Torah present then, there need not be any Sefer Torah present for Nefilas Apayim now. Nevertheless, the Ramo (שם סעיף ב') rules that there is no Nefilas Apayim in a place where there is no Aron with a Sefer Torah, and in such a place, Tachanun is recited without putting one's head down. The Mishnah Berurah (שם ס"ק י"א) points out that there really does not have to be an Aron, as a Sefer Torah alone suffices, and the presence of a Sefer Torah obligates even an individual in his home to put his head down for Tachanun; he then quotes a dispute about what to do if there is no Sefer Torah in a room, but there are other Seforim there. The Kaf HaChaim (שם אות מ"ה) also quotes those who say that one does "fall" for Tachanun even without a Sefer Torah, as long as there other Seforim present, but he concludes that others, including the Kitzur Shulchan Aruch (סימן כ"ב סעיף ד'), disagree, and that it is therefore better to "fall" only in the presence of a Sefer Torah. The Kaf HaChaim earlier (שם אות מ', מ"א) notes, however, that there really are several different opinions as to whether or not a Sefer Torah (or any other Sefer) must be present to allow for Nefilas Apayim. HaRav Hershel Schachter (ספר נפש הרב, ליקוטי הנהגות או"ח, עמוד קל"ד) relates that it was the custom of HaRav Yosef Dov Soloveitchik to put his face down for Tachanun even when no Sefer Torah was around, and Rav Yechiel Michel Tukatchinsky (ספר עיר הקדש והמקדש, חלק ב' פרק כ"ה אות ג' סעיף ח') writes that such was also the practice in Yerushalayim.
The Shulchan Aruch (שם סעיף א') rules that when one puts one's head down for Tachanun, the custom is to lean on one's left arm, but the Ramo (שם) writes that some say that it should be on the right arm; the Mishnah Berurah (שם ס"ק ד',ה') explains the reason for each view. The Ramo (שם) thus concludes that for the Shacharis Tachanun, when one (who is right-handed) has Tefillin on his left arm, one should lean on his right arm, while for the Minchah Tachanun, one should lean on his left arm. The Taz (שם ס"ק ג') writes that this is the most wide-spread practice, and should be followed, while the Magen Avraham (שם ס"ק ג'), after quoting different reasons for leaning in different directions, concludes that one should stick to the accepted customs of old. According to the Sefer Maaseh Rav (אות נ'), however, it was the practice of the Vilna Gaon to always lean on his left arm, even for the Shacharis Tachanun (despite having Tefillin on that arm), as alluded to in his commentary on the Shulchan Aruch (ביאור הגר"א לאו"ח שם בד"ה תפלין). The Chayei Adam (כלל ל"ב סעיף ל"ג) quotes this view as well, but then adds that if one is in a place where everyone follows one view, one should not follow the other view, and the Mishnah Berurah (שם ס"ק ו') concurs. Nevertheless, HaRav Hershel Schachter reports (שם) that HaRav Yosef Dov Soloveitchik said Tachanun while leaning on his left arm under all circumstances. It should be noted that the Be'er Heitev (שם סוף ס"ק ב') quotes from the Ari Zal that one should lean specifically on one's arm, and not on one's hand; the Ben Ish Chai on this Parsha (שנה ראשונה אות י"ג) says this as well, and then adds that currently, the practice among Sephardim is not to do the actual Nefilas Apayim at all (but just to say the Tefillah without putting the head down), and he explains this based on Kabballistic sources.
The Shulchan Aruch (שם סעיף ב') states that this Tefillah must be said when one is sitting; the Beis Yosef (שם בד"ה כתב ריב"ש) writes that this is based upon Kabballah, although he quotes from the Rivash (שו"ת הריב"ש סימן תי"ב) that one need not necessarily be sitting for Tachanun. The Ramo, in his Darkei Moshe on the Tur (או"ח שם אות ב'), writes that the Maharil would also sometimes recite Tachanun when standing. The Mishnah Berurah (שם ס"ק י'), as well as the aforementioned Chayei Adam (שם), the Kitzur Shulchan Aruch (שם סעיף ג'), and others cited by the Kaf HaChaim (שם אות ל"ח), all say that one may rely on the view of the Rivash (שם) if there is no other choice, but it is undoubtedly preferable to recite Tachanun when sitting. It should be noted that according to the Shaarei Teshuvah (שם ס"ק ב'), one who sees the members of the Tzibbur sitting down to say Tachanun should also sit in that position even though he may not be up to that point in the davening himself. As is well known, there are numerous occasions on which Tachanun is omitted, as outlined in the Shulchan Aruch (שם סעיפים ד'-ו'), and discussed by the Meforshim there.