In the Apology, Socrates reasoned that he should receive the death penalty, not a light decision by any means. Socrates was imprisoned and essentially forced to recant his beliefs.
In light of this, Socrates believed that, in order to remain true to his beliefs, he should receive, and would accept, the death penalty. His conviction was so resolute in his beliefs that to deny them would be a worse fate than death. He writes his book outlining his core beliefs and decrying the injustice of the situation, while also accepting that the gods controlled his fate and that following his convictions would be worth more than his life. He accepted that this was not a fair trial but knew that justice would eventually be served, and he would ensure that his conscience was clear upon his death.
It's not so much that Socrates wanted to be executed; he didn't have a death wish, or anything. It's just that he'd lived his whole life in Athens, always abided by its laws and so naturally thought it would be...
(The entire section contains 4 answers and 616 words.)