One of the most well-known scenes in the first Star Wars film involves Luke, Chewbacca, Han, and Leia escaping some blaster fire by jumping headfirst into a trash compactor. When they fall inside, they find themselves in a large enclosure filled with trash and water... at least, they hope it's water. There's even a giant tentacled monster swimming around, and fans have often wondered how they would have handled being in that sort of situation.
If you've seen it, you've probably done the same, and you're not alone. Fans of the films have been all over the internet discussing the best way to get out of the trash compactor on the Death Star, and these are the best ways they have come up with over the years.
If you're fortunate enough to have in your possession an astromech droid and a golden protocol droid who was built by a young Darth Vader, you're in luck! Just as the characters do in the movie, you need to reach him on your coms device and ask that he kindly "Shut down all the garbage smashers on the detention level, will ya?" This would have made the characters' lives much easier, but it would have been smarter to ask that C-3PO open all the doors instead.
You'll want to do this the moment you find yourself in unit 3263827. If you wait until the compactor activates, you're going to find yourself in a dangerous predicament, and nobody wants to be smashed into atoms in an Imperial garbage bin.
The characters in the movie identify the room as a garbage compactor, so it's unlikely that the water is the result of sewage. It may have accumulated over time, or it may be a regular feature of Imperial trash compactors, but it doesn't matter why it's there, only that it is there. It had to get there somehow, and there must be a way that it's drained out. If it comes from a plumbing system of some kind, there may be a drain you can dismantle and climb through.
This method might be tricky, since most pipes are rarely wide enough for people to pass through, but it is possible. If the organic waste and water come from sewage, you can still try to find a way to get through it, but it may be better to simply let the walls close in on you rather than crawl through muck and grime only to perish in a different horrific yet disgusting manner.
This one is going to require some skill and quick work, but it is likely that the trash compactor doesn't reach all the way to the ceiling. If it did, the compressed water would stop it from closing in completely. If there is space above, you might be able to reach it. You can't use the walls to climb up due to their general sliminess, but you can create a rudimentary ladder or plane to help you get up there.
Start with the largest pieces for your base, and if you have wire or another implement to tie them together, do that. You can use your clothes to hold parts of it together, and if you're shy, just remember that you're going to be smashed into mush with garbage, so you can throw away your modesty with the rest of the trash.
If you're lucky and quick enough, you just may be able to reach the top. Once you get there, you can wait until the walls return to their starting position. Move back down to the floor and figure out how to open the door.
Here's something you should already know: Don't bother the gigantic monster lurking under the water. There's a good chance it was put there to break down any organic matter that ends up in the compactor, or it could simply be a Stormtrooper's pet that was flushed down the drain and has grown to massive proportions. Whatever the reason it's there, you don't want to mess with it.
This is evident in the film, as it is shown to have a taste for young Jedis. Most of the Dianoga isn't shown, but it has a significantly large eyestalk and at least one gigantic tentacle. There are probably more disturbing facts about it, but you'll never know because you should avoid it at all costs.