Why does anyone write anything? To speculate is to diminish the art. The New Critics would not like this question...
Poetry is confession, catharsis, therapy, a way of making sense of the world, a chance to have one's words immortalized, and puzzle-making: putting the perfect words in the perfect order. Namely, the poem is her most mature attempt to make sense of her mental illness (which lead to previous unsuccessful suicide attempts), her family (father and mother), her ex-husband, and the cruelty, dehumanization, and absurdity of the modern world.
Plath attempts to be absurdist and confessional poet in "Lady Lazarus," her magnum opus along with "Daddy." Anne Stevenson lauds the paradoxical complexity of Plath's poetry, saying it "is all of a piece":
Its moments of tenderness work upon the heart as surely as its moments of terror and harsh resentment. And despite her exaggerated tone and the extreme violence of some of her energy, Plath did, courageously, open a door to reality.
Stevenson goes on to praise Plath's "Lady Lazarus" persona "with its agressive assertion of regeneration, rejoice[ing] in so much verbal energy that the justice or injustice of the poet's accusations cease to matter."
The poem does not condone suicide. Rather, it rises above it, if only for a moment. Her poetry works best in barrage: imagery against men, materialism, sexism, self, suffering, and tradition. Regardless of the poet, the poem, like all good art, affirms and breathes life.
One can only guess at the precise reason why she wrote the poem: she was full of rage and knowing what would happen later, she felt desperate and helpless. According to Bitter Fame: A Life of Sylvia Plath (1989), by Mariner Books, a biography of Sylvia Plath by Anne Stevenson, Stevenson discusses that Plath wrote the poem during seven days in October of 1962. Plath later committed suicide shortly thereafter on February 11, 1963. The poem could be considered autobiographical placing Plath herself in the middle of the mythic world as Lady Lazarus. The poem is considered to have no feelings or coldness of rage and with many German tags, suggesting a hint of connection to her father, whom spoke with a heavy thick German accent.