How did Odysseus get himself out of the cave?
By hiding under the cyclop's sheep.
On the underside of Polyphemus' sheep. When Polyphemus let his
sheep out into the pasture, Odysseus and the remaining crew rode
out with the sheep.
Odysseus gives Polyphemus a false name and then Odysseus and the
men find a large olive stump and sharpen it into a massive spear.
They then hide it and then Odysseus and the men feed Polyphemus
wine until he is drunk and then they Odysseus and the men spear
Polyphemus' eye, blinding him and then Odysseus and the men hide
underneath the sheep, with Odysseus hiding beneath the largest
ram.