Peace is often most easily reached when two parties with different goals or aversion to one another work together for a common goal. When people collaborate against a common enemy they feel a strong sense of bonding and reliance upon one another, regardless of past difficulties. This presents itself in many ways, through natural disasters and calamities, but also during times of war when atrocities have been performed and all are able to agree that the opposing force is a clear enemy.
In The Lord of the Rings, two competing parties find they must work together. Frodo and Sam are on a quest to destroy the ring of power, and they only possible way to do so is to bring it deep into enemy territory. Gollum is obsessed with the ring, and wishes more than anything that it not be destroyed. However, if Frodo and Sam are killed, the ring will be taken by Orcs and Gollum will never be able to see it again. Therefore it is in Gollum’s best interest to help the hobbits along their journey so they are not spotted, and it is in Frodo and Sam’s best interest to accept the guidance so they are not killed. Though the two groups initially hate one another, they begin to respect and understand one another as they cooperate. Here is a clip from the movie where Gollum first tries to attack the hobbits, though later he is subdued.