One day at the oracle, Apollo tells Oedipus about his own prophecy. The prophecy basically states that Oedipus will kill his own father and then marry his mother. Out of fear, Oedipus flees to stop the prophecy from occurring. This decision actually backfires for Oedipus and instead him fleeing leads to the prophecy becoming true.
Oedipus wants to be a good leader and show that he can solve any problem his people have. One of the main problems/questions that Thebes has, is their former king, Laius was killed. So, Oedipus wants to figure out everything about it. He says, whoever killed him must be banished to show he means business, this eventually comes back to haunt him.
A messenger from Corinth comes to tell Oedipus that his parents have died and that he must go with him to Corinth, for Oedipus is their new king. This gives the audience hope in a weird way because in hearing the death of who Oedipus thinks his parents are, now the prophecy can no longer be true. But, as we continue we realize that this hope will leave very, very soon.
Oedipus, goes to meet with the Shepard to find out more about his story and where/who he truly came from. At first, he believes that maybe he was born to slave. But, after a conversation with the Shepard he realizes that he is actually the son of his wife. After he realizes the problem he leaves and tries to find Jocasta and fix things.
Oedipus tries to find Jocasta and repair everything, but its too late and their fate is sealed. He walks in on Jocasta hanging from a rope and dead. This breaks Oedipus and so he stabs out his eyes.
At the end of the story, Oedipus must leave because of the declaration he made at the beginning of the story. This is the part where everything sort of settles down and comes to an end, therefore allowing the audience to breath and relax.