I’m assuming everyone has read the dialogue Crito, so i’ll try not to summarize it too much. From what i can tell, Crito is trying to persuade Socrates into escaping from the prison and escape being executed. Crito starts off by saying that if socrates refuses to escape, he will not only have lost a close friend, but also will be looked down upon by the majority because they will believe that crito did not try to save Socrates and that he valued money more than the life of a close friend (assuming Crito had a chance to save Socrates with a payment of money).
Socrates responds stating that one should not care for the opinions of the majority in such a situation. — Later on in the dialogue, Socrates compares the body and the soul to support his previous statement and the idea that, one should not follow the advice of the majority but rather the advise of a wise person who knows what sorts of things are just and unjust (possibly the God(s)?) By this, Socrates is explaining that he does not fear death if he faces death as a just man, and he would rather live justly and die than unjustly and live. Socrates supports his opinion once more, by saying that a person who lives in a society agrees to follow that societies rules as they have the freedom to leave or stay. Also, all the people who break the rules they agreed to follow are unjust, so to Socrates being unjust is worse than being dead. Socrates chooses to be loyal to the God(s) and accept death. He also stays very loyal to his own beliefs and his philosophical views. (Which is interesting because more often than not, people give up their views in life or death situations.
) The main reasons i believe socrates accepted death rather than go into exile, are because of what i previously mentioned and also he needed to fulfill his duties as a philosopher. He needed to maintain his civil stature and thus retain the value of his teachings as ethically correct. If he had chosen to escape, he would have gone against his own beliefs and practices which he openly shared with others.
Maybe he knew his death would have more of a historical impact on philosophy.