Prior to the Time of Troubles and Ao banishing all the Gods to Toril several deities had taken steps to retain some of their power by secreting it away in the mortal realms. Mystra had scattered a number of objects amongst her faithful as insurance against such an event
One particular item, a pendant of some power, was placed in the hands of a young woman called Midnight. After Ao banished the Gods Mystra in a mortal avatar was captured by Bane before being able to regather her power.
She was held prisoner for some time in Bane's Castle Kilgrave in Northern Cormyr, but retained sufficient ability to direct Midnight to try to rescue her.
This is all detailed in "Shadowdale", the first in the Avatar series and there is a thread on wotc discussing just the question you raised
http://boards1.wizards.com/archive/inde ... 54892.html
Mystra eventually escaped Bane, I won't spoil things by revealing how. After reclaiming the pendant from Midnight she set about her attempt to return to the pantheon. Here it was that she encountered Helm, the only deity left his power by Ao, and died trying to win passed him on the celestial stairway.
Me childr'n 'll make o' their sens yer greatest friends or yer most implacable foe.
If yer daft enough ti git on our wrong side ye'v only yersen ti blame.