It is relayed in the Midrash that King David was anguished when he prophesized that the Temple will be destroyed and that as a result, the sacrifices will cease. He wished to understand how, in such circumstances, the Jews will be able to atone for their sins. G-d answered him that when the Jewish people will suffer after the destruction of the Temple, they should gather together, confess their sins, recite Selichot and He will accept their prayers.
As the High Holidays approach, Jewish people begin to prepare for their arrival, reciting Selichot-according to the Ashkenazic custom for a minimum of four days before Rosh Hashanah and according to Sephardic custom for the entire month of Elul.
Selichot are recited in the Synagogue- there are several passages contained in the Selichot that can only be said in the presence of a quorum of ten Jewish men. They are recited in the early morning before the daily morning prayers- they take approximately forty-five minutes to recite.
It is the common practice to also recite Selichot in the ten days between Rosh Hashanah holiday and Yom Kippur- known as the Ten Days of Repentance (this is not the Chabad custom-barring the third of Tishrei when they are recited due to the Fast of Gedaliah that takes place).
The most popular night of Selichot in Ashkenazi circles is the first night when all of the community gather together to attend the late-night service on Saturday night. Elaborate melodies are sung; some congregations even have a choir participating in this first night’s service. The first night also has more Selichot than any other night before Rosh Hashanah.
A central part of the Selichot service is the recitation of G-d’s Thirteen Attributes of mercy that He revealed to Moshe after the Jewish people sinned with the Golden Calf. The Thirteen Attributes are 1.HaShem, 2.HaShem, 3.G-d, 4.Merciful, 5.and gracious, 6.long-suffering, 7.abundant in goodness, 8.and truth, 9.keeping mercy unto the thousandth generation, 10.forgiving iniquity, 11.and transgression, 12.and sin, 13.who cleanses.
It may be asked why three of the attributes are names of G-d, two of them being the same name. The reason is that different names of G-d refer to different characteristics of G-d. The name of G-d that appears twice- “HaShem”- is the Name used when G-d is acting through his merciful characteristic and the Talmud explains that the double appearance is to show that G-d is merciful before a person sins and is just as merciful after a person sins.