Why do we fast on Tannis Esther? In memory of what historical occurrence?
The Rambam (Hilchos Taaniyos 5:5) says the fast is to commemorate the three days the Jews fasted before Haman's demise (13th-15th of Nissan).
The Avudraham doesn't like the Rambam's pshat and says that all the Jews fasted on the 13th of Adar before going out to fight their enemies.
The Lubavitcher Rebbe brings both these opinions, explains why each one doesn't learn like the other, and then gives his own answer by first asking another question.
The Rebbe wonders why we call it "The Fast of Esther". According to both the Rambam and the Avudraham everybody fasted.
The Rebbe answers that like the Avudraham, everybody should have fasted on the 13th of Adar. However, they were not allowed to do so since fasting would have made them weak and prevented them from defending themselves properly. Instead they accepted upon themselves to fast at a different time (as brought in Shulchan Aruch Orech Chaim 571:3). This left only Esther, who was safe in the palace, free to fast, since she didn't have to defend herself.
So, according to the Rebbe, this is why it is called Ta'anis Esther, since only Esther fasted on the 13th of Adar.
See all the details and sources here.
Some say the Jews fasted the day they fought, or the day before it. (So on Purim, more or less.)
Some say that the holiday commemorates "divrei hatzomos v'zaakasam", the matter of their fasts and cries; so we fast the day before Purim to commemorate that in the Purim story, Esther and the Jewish people all fasted and prayed before she approached the king. (Even though the actual fasting in the Purim story happened not in the Hebrew month of Adar in which Purim is celebrated, but 11 months earlier, in Nisan of the previous year).
Lastly, the Raavad in Sefer HaEshkol says the fast has nothing to do with any of this. It's that if people could eat the day before Purim, they might drink too, and once they're drinking ... well .. as Rabbi Hershel Welcher put it, "We want people to show up to Megillah reading, able to stand up on two feet!"
The widespread reason given why we fast on ערב פורים is to commemorate the fasts mentioned in the מגילה which אסתר requested the Jews to observe before she went to the king. However, the Abudraham (סדר תפלות תעניות ופי׳, ועיין לקו״ש ח״ו עמ׳ 371) states several difficulties with this explanation. Firstly, אסתר went to אחשורוש on the first night of פסח, not on ערב פורים. Additionally, those fasts lasted for three days and nights.
Other explanations have been offered to explain why we fast. The Levush (סימן תרפו) explains that on the 13th of Adar the Jews gathered to defend themselves against their enemies, and they would have had to pray for compassion. Probably they fasted on that day; just as we find in the מדרש that משה רבינו fasted during the war against עמלק. Since we commemorate the miracle that occurred on פורים we act like them by emulating their fasting and prayers. The Lubavitcher Rebbe adds (לקו״ש ח״ו עמ׳ 371) that this explains why the fast is named תענית אסתר, for anyone who needed to fight to defend themself (which includes all Jews young and old, male and female) was Halachicly prohibited from fasting (שו״ע או״ח סו״ס תקע״א) in order not to diminish their strength, so the only person who ended up actually fasting was אסתר.
The בית יוסף was known to have a חברותא with a מלאך. Once, while they were learning together the מלאך revealed a fascinating reason for תענית אסתר. On פורים we are exceedingly happy and we feast and celebrate in a way of "עד דלא ידע". In order to preemptively avert any undesirable behavior that may come as a result of the festivities, we fast the day beforehand (מגיד משרים פ' ויקהל ד״ה אור, הו״ד בס׳ "קב הישר" פרק צז).
Another answer is brought in the name of the early Kabbalists (שו״ת שבט הקהתי ח״א סי׳ רג). Although the decree of המן was not carried out, it was not completely abolished, and remnants of the decree are fulfilled in the subsequent calamities that have occurred to the Jewish people. [This is hinted to in the מגילה in which the word "חור" is written with a large ח׳ and the word "ותכתוב" has a large ת׳, alluding the atrocious pogroms of Chelminsky which began in the year ת״ח (5408 - 1648)]. חז״ל therefore established a fast day every year, in order for us to pray to annul this ongoing evil decree of המן.