The Havdalah service recited Saturday night is meant to declare the difference between the sanctity of the Shabbat and the mundane of the rest of the week. In that sense the Havdalah can be viewed as the flip side of the Kidush recited on Friday night. As a matter of fact, the Rambam presents Kidush and Havdalah in just that way. In Hilchot Shabat (29/1) the Rambam writes:”It is a positive command to sanctify the day of Shabat with words as it is written ‘Zachor et yom ha’Shabat lekadsho’ commemorate the day of Shabat so as to sanctify it…and one must commemorate it (the Shabat) as it enters and at it’s departure. When it enters with Kidush and at it’s departure with Havdalah”.
The opinion of the Rambam, as reflected in the above-mentioned paragraph is that Havdalah is part of the deorita (biblical) requirement to note the special status of Shabat. The Rambam follows through with the parallel of Kidush and Havdalah, when he notes in Halachah 6 that though the deorita requirement is fulfilled by stating the unique status of Shabat, the rabbinic requirement is to recite the words of Kidush and Havdalah over a cup of wine. Other Rishonim, amongst them Rashi, share the view that Havdalah is of biblical origin. (It should be noted that Rashi appears to understand that even the use of wine is mi’deorita.-See Rashi Nazir 4a)
Other Rishonim felt that there is no requirement of Havdalah mi’deorita and that the entire concept of a Havdalah is of Rabbinic origin. Such an opinion is quoted by the Beit Yosef (OC 296) in the name of the Orchot Chayim.
Whether or not the roots of Havdalah are mi’deorita, the form of its’ fulfillment is of Rabbinic origin. The Gemara in Berachot 33a teaches that originally the Rabbis ordained that Havdalah be said as part of Tefilah; later as society became financially able they decreed it be said over wine. When people were less able to afford the cost of wine, the Rabbis returned Havdalah to its’ original format, as part of Tefilah. At a later time, they declared that Havdalah be said in Tefilah and recited at home over wine. Rava (33b) explains that this was meant to mirror the model of Kidush where we recite a blessing of Kidush in Tefilah and repeat the Kidush with wine at home.
In light of this Gemara, the Halacha is that ideally one should recite words of Havdalah in the Shmone Esreh on Saturday night and then recite Havdalah at home with wine. In the event that one forgets to recite the Havdalah in his Tefilah, there is no need to repeat the Tefilah as he can suffice with the Havdalah recited over wine. Should he not have wine to recite Havdalah with, then he would need to repeat the Shmone Esreh with the addition of Havdalah (OC 294/1-2). Should one make or hear Havdalah over wine before reciting his Tefilah then he must still include the Havdalah in his Shmone Esreh (Mishna Berura OC 294 /1).
In the event one forgets to recite the Havdalah in its proper place during the Shmone Esreh and realizes his mistake before concluding his Tefilah, if he has not yet said the name of Hashem he recites the Havdalah and then concludes the beracha. When one realizes after concluding the beracha of Chonen Hadaat that the Havdalah has been omitted, if he has no wine and will not be reciting Kidush at home with wine he must return to the beginning of Birkat Chonen Hadaat. In the event that one can recite Havdalah later at home we find several different opinions in the Roshonim relating to several situations.
If the beracha of Daat has been concluded, but the next beracha has not yet commenced, Rabenu Elchanan (quoted in the tur OC 294) states that one should return to the point where the Havdalah would be inserted and continue from there. Rabenu Tam goes even further and suggests that, if one desires to, he may return to the Havdalah even if he has continued to recite other brachot. The Rambam quotes the opinion of some scholars who feel that if the beracha of Shema Kolenu has not been recited Havdalah should be inserted in that beracha. (See the Tur in the name of the Rambam-in the Rambam I could find no such statement. See Rambam Tefilah 2/12 and 10/14)
The Rosh and others reject these opinions and write that if one has concluded Birkat Chonen Hadaat they should not return to the Havdalah. (If Havdalah will be said later at home.) This is the accepted opinion in later halachic ruling. The Aruch Ha’Shulchan points out that one should say the Havdalah at the conclusion of Shmone Esreh before taking three steps back. (Aruch Hashulchan OC 294/10 For further study on this issue see Shulchan Aruch 294/5 and notes 8-9 in Mishna Berurah)