One who wishes to observe the voluntary fast on Ereb Rosh Hashanah must declare his acceptance of the fast the previous day. If one fasted without having formally accepted the fast the previous day, he cannot recite "Anenu" on the day of the fast. The acceptance is declared at the end of the Amida prayer at Minha the previous day, before "Oseh Shalom," using the text found in many Siddurim.
The acceptance should be made specifically during Minha Ketana (Minha recited late in the afternoon), though if one prayed Minha Gedola (in the early afternoon) and declared his acceptance then, the acceptance is valid. Before Minha, however, such as if one declared his acceptance during Shaharit, the acceptance is invalid and must be repeated during Minha. If one forgot to accept the fast during Minha, he may still do so after Minha, until sundown. If he forgot to make the declaration before sundown, then "Be’di’abad" (after the fact) he may do so even later, during Ben Ha’shemashot (13.5 minutes after sundown).
If one will be praying Minha just before sundown and will finish his prayer only after sundown, he should preferably announce his acceptance before praying Minha.
If one did not accept the fast by the end of Ben Ha’shemashot, and did so afterward, he may not recite "Anenu" the next day, and the Halachic authorities debate the question of whether he is even required to fast. The consensus is that if the acceptance was made at that point under the mistaken assumption that it is valid, then the acceptance is not binding and the person does not have to fast.
If one did not verbalize his acceptance of his fast, but merely thought it in his mind, the acceptance is nevertheless valid and he may recite "Anenu" the next day, though he should preferably verbalize his acceptance afterward. This is the ruling of the Shulhan Aruch. However, this applies only if he thought in his mind the actual content of the formal text of the acceptance. If he just thought in his mind that he would fast in a general sense, this acceptance is not valid. Likewise, if a person made a mental note before Minha that he must declare his acceptance of the fast, but then forgot to recite the text of the acceptance during the prayer, this acceptance is not valid.
The reason why a formal acceptance is required the previous day is because one must pray that G-d should accept his fast as a sacrifice that brings atonement. Therefore, when declaring the acceptance one must have this intention in mind, and pray that G-d should accept his fast in lieu of a sacrifice for the purpose of atonement.
The text of the acceptance is that which was written by the Hida (Rav Haim Yosef David Azulai, 1724-1807), in Moreh Be’esba (3:127). (Listen to audio recording for the text.) In this text, one stipulates that if he finds himself unable to complete the fast, he will recite the chapter of "Mizmor Le’David" (Tehillim 23) and will then be absolved from the fast. One should not say in his declaration that he accepts the fast "Beli Neder," for then it would not be a resolute acceptance. Nevertheless, after the fact, if one did say "Beli Neder," his acceptance is valid. One must clarify when accepting the fast that he does not intend to take on the practice of fasting on Ereb Rosh Hashanah each year. If one did not clearly stipulate that he does not accept this practice each year, and he fasted on Ereb Rosh Hashanah three consecutive years, then if he wants to discontinue this practice he must perform Hatarat Nedarim before a Bet Din.
If one accepted the fast but feels unable to complete the fast, he recites the chapter of "Mizmor Le’David" and may then eat, as he had stipulated when he accepted the fast. The recitation of "Mizmor Le’David" has the effect of retroactively annulling the acceptance, such that the person is considered to have never accepted the fast in the first place. Therefore, if one mistakenly ate or drink, thus violating his vow to fast, he should recite "Mizmor Le’David" which has the effect of retroactively annulling his acceptance, so that he will not have committed a religious offense.
When accepting the fast, one must specify that he accepts a "Ta’anit Yahid" ("private fast"). Declaring that one accepts just a "Ta’anit" implies that he accepts a public fast day, which has with it additional stringencies, such as prohibitions against bathing and wearing leather shoes. Additionally, a public fast must be observed until Set Ha’kochavim (nightfall), whereas a private fast is observed until whichever time one stipulates. When accepting the Ereb Rosh Hashanah fast, it is best to declare one’s commitment to fast until after Arbit the next night. He should clarify that he will fast until after he prays Arbit, as opposed to the congregational recitation of Arbit, as there may be many different congregations in the area.