There are a lot of things that can be stated in connection to this question. In light of this let me make three points.
First, we need to look at what Socrates does in view of his worldview, rather than our worldview. When we do this, we can begin to appreciate Socrates's logic of why he is unafraid to die, even if he is in prison unjustly. In short, he is not being irrational in his view of things.
Second, in light of point one, we can say that Socrates is unafraid of death, because he is a true philosopher. Socrates believes that he body is a prison of the soul. Hence, to leave his body is not a bad development. In fact, death would be gain for Socrates in a sense, because he can now meditate on the form or ultimate reality without the hindrance of his body.
Finally, Socrates as a philosopher believes in upholding the laws of the city. At times, the law could be interpreted and applied wrongly, but he still believes that people should uphold them. This is another reason why Socrates does not complain about his lot in life.