Robert comes back from hunting (which is good) but he's dying (which is bad). He was too drunk and a boar wounded him. (Why was he drunk? His Lannister squire kept refilling his wineskin.)
While he's dying, Robert dictates his will: he wants Joffrey to be king eventually, but he wants Eddard to be in charge until Joffrey is old enough.
Eddard doesn't have the heart to tell Robert that Joffrey is not actually his son, but he writes the will to say "my heir" instead (31).
Renly offers Eddard enough soldiers to grab the children and Cersei, but Eddard thinks that children should be left out of it. And, frankly, Renly isn't the rightful heir: Robert's middle brother Stannis is.
So, to make sure that the rightful heir gets the throne, (a) Eddard writes a letter to Stannis; and (b) he asks Petyr to bribe the City Watch, which Petyr agrees to do. Funny how doing the right thing often involves bribery or violence in this world.