881. Committing in Advance to a Fast
127:2 If an individual wants to take a fast upon himself, he must commit to do so the day before at mincha. In the bracha of Shema Koleinu, he should resolve in his heart that he will fast and before saying "Yihiyu l'ratzon imrei fi" at the end of Shemoneh Esrei, he should say "Master of the universe, I stand before you on this fast etc." as appears in the siddur. (If one did not recite this before saying "Yihiyu l'ratzon," he should do so after, before he takes his three steps back - Mishnah Brurah 562:33.) It makes no difference that he will continue to eat and drink after this until dawn. If one wants to fast for several consecutive days, committing just once is sufficient even though he will eat and drink in the nights between the fasts. If one decides to fast on some non-consecutive days, such as Monday, Thursday and Monday, he should commit to each fast day individually in the mincha service on the day before. (The current accepted practice is to accept all fasts in a series at once - Rema 562:8.)
127:3 If a person is accustomed to fast during the ten days of repentance (i.e., between Rosh Hashana and Yom Kippur), on the first day of Selichos or on the day before Rosh Hashana, then he need not commit in advance that he will fast on these days; they are already in effect for him based on precedent. (This is true even if it's his first time fasting on these days but others in his town have already established the precedent - Bi'ur Halacha 562:2 s.v. she'ragil l'hisanos.) Similarly, a fast after having a bad dream does not need to be declared in advance. The same is true for the fasts held on the Monday, Thursday and Monday following Pesach and Succos; if one responded Amen after the "Mi shebeirach" recited in shul for this with the intention to fast, that is sufficient and he need not make another declaration. However, if he changed his mind and decided not to fast, this is permitted because he did not commit explicitly and he did not verbalize an intention to fast. (Some authorities feel that such thought is binding and one may not retract - Mishnah Brurah 562:39.)