Drupada had no children so he did austerities in the forest seeking the blessings of Shiva for begetting a son.
Shiva granted him the boon that a girl would be born to him, but will transform into a boy later.
As prophesied, Amba was reborn as Shikhandini, whose true gender was not disclosed and she was brought up as a boy.
When Drupada got his daughter in the garb of a son married to the daughter of Hiranyavarna, the king of Dasharna, his true identity was revealed not only to the chagrin of the girl, her father but also to Shikandini himself.
The agitated Hiranyavarna declared war on Panchala.
Distressed by the turn of events, Shikhandini went into the forest to fast unto death but was saved by a yaksha (a forest deity), Sthunakarna, who helped him by offering his own gender in exchange to Shikandini's female gender.
Thus Shikhandini became the male Shikhandi.
After Hiranyavarna's death, Shikhandi returned to swap sexes with the yaksha, however the yaksha was cursed by his master the god Kubera to remain female until Shikhandi's death.

In the variant where the garland of ever-fresh lotuses is mentioned, Shikhandini wears the garland once and Drupada realizes that she will slay Bhishma.

Meanwhile, over the course of time, Ambika and Ambalika had grandchildren Kauravas and Pandavas, who became arch enemies.
Draupadi, the daughter of Drupada, was married to the Pandavas.
When a great Kurukshetra war between Pandavas and Kauravas ensued, Shikhandi sided with his brothers-in-law, while Bhishma was with the Kauravas.
Bhishma had vowed to "not to shoot at a woman, anyone who used to be a woman or has a woman’s name or appears to be a woman", so he narrated to the Kaurava leader Duryodhana Amba's tale and refused to fight to Shikhandi.
When Bhishma led the Kaurava army, Shikhandi rode as the charioteer of Arjuna, the third of the Pandava brothers.
On seeing Shikhandi, Bhishma lowered his weapons.
Shikhandi and Arjuna pierced Bhishma's body, though all Shikhandi's arrows were not so effective in wounding Bhishma.
At this stage, it was also the desire of Bhishma to die.
Before collapsing, he cried out that it was Arjuna's arrow that killed him and not of Shikhandi.
Bhishma lay on a bed of arrows for days and died on the holy day of Uttarayana.
Amba's vengeance was fulfilled when Shikhandi became the cause of Bhishma's death.

Shikhandi is killed in a sword fight with Ashwatthama when Ashwatthama, Kripacharya, and Kritavarma attacked the Pandava camp on the night of the final day of battle.
Drupada had no children so he did austerities in the forest seeking the blessings of Shiva for begetting a son. Shiva granted him the boon that a girl would be born to him, but will transform into a boy later. As prophesied, Amba was reborn as Shikhandini, whose true gender was not disclosed and she was brought up as a boy. When Drupada got his daughter in the garb of a son married to the daughter of Hiranyavarna, the king of Dasharna, his true identity was revealed not only to the chagrin of the girl, her father but also to Shikandini himself. The agitated Hiranyavarna declared war on Panchala. Distressed by the turn of events, Shikhandini went into the forest to fast unto death but was saved by a yaksha (a forest deity), Sthunakarna, who helped him by offering his own gender in exchange to Shikandini's female gender. Thus Shikhandini became the male Shikhandi. After Hiranyavarna's death, Shikhandi returned to swap sexes with the yaksha, however the yaksha was cursed by his master the god Kubera to remain female until Shikhandi's death.
In the variant where the garland of ever-fresh lotuses is mentioned, Shikhandini wears the garland once and Drupada realizes that she will slay Bhishma.
Meanwhile, over the course of time, Ambika and Ambalika had grandchildren Kauravas and Pandavas, who became arch enemies. Draupadi, the daughter of Drupada, was married to the Pandavas. When a great Kurukshetra war between Pandavas and Kauravas ensued, Shikhandi sided with his brothers-in-law, while Bhishma was with the Kauravas. Bhishma had vowed to "not to shoot at a woman, anyone who used to be a woman or has a woman’s name or appears to be a woman", so he narrated to the Kaurava leader Duryodhana Amba's tale and refused to fight to Shikhandi. When Bhishma led the Kaurava army, Shikhandi rode as the charioteer of Arjuna, the third of the Pandava brothers. On seeing Shikhandi, Bhishma lowered his weapons. Shikhandi and Arjuna pierced Bhishma's body, though all Shikhandi's arrows were not so effective in wounding Bhishma. At this stage, it was also the desire of Bhishma to die. Before collapsing, he cried out that it was Arjuna's arrow that killed him and not of Shikhandi. Bhishma lay on a bed of arrows for days and died on the holy day of Uttarayana. Amba's vengeance was fulfilled when Shikhandi became the cause of Bhishma's death.
Shikhandi is killed in a sword fight with Ashwatthama when Ashwatthama, Kripacharya, and Kritavarma attacked the Pandava camp on the night of the final day of battle.
Amba (Mahabharata)