In the later eras, a world war may come about due to a civ's greed for power or land or if it feels threatened. When this happens most or all civs are at war with each other, and these wars are long and costly. They usually happen in the Industrial or Modern Era, seeing as there are more powerful units to wield. If you don't get pulled into the world war, try to avoid declaring war on other civs, because anyone with whom you aren't at war will get in the way and you might lose several cities or other valuable resources.
As time goes on one side will try to make peace either by just asking or by demanding something (tech, gold, or a Great Person). It would be in the interest of the player to make peace as soon as possible, but only if you are losing or if you didn't start the war. If you did start the war it's up to you to decide if it's worth it.
Always remember that the AIs have a memory, so they will remember a war between you or other AIs for a long time in the game.