Dumpster diving, or trash-picking, is an interesting way to find free items to reuse, re-purpose, and recreate. Many dumpster dive for food but people also throw away furniture and resalable goods. You can land in thorny legal territory if you're not careful, even though dumpster diving was declared legal by the Supreme Court. It's important to understand what you can and can not do. After all, just because someone else doesn't want it doesn't mean it's yours.
The laws for trespassing vary from place to place so it's best to check before you dive. In some cases, municipalities have pressed charges even when the owners of the dumpsters haven't wanted to. If you're not trespassing on someone's property you're generally safe, provided you're neat, you don't harass anyone and the dumpster is open. Trash in public for pick-up is considered not to be protected under privacy laws but trash on private property or locked up trash is protected--so don't trespass.
Whatever you do, make sure that the dumpster is opened before you go in it. Do not try to pick the lock, break the chain, or otherwise open a locked dumpster. If you do this, you're automatically trespassing and could get nailed for trespassing and destruction of property. Do not hop a fence or pick a lock to get to a dumpster off a public street--this is also automatically trespassing. Only dive dumpsters that are open and on a public street or alley.
Make sure that you're neat when you're looking. If you take something out, put it back. Working with a partner will make this easier and also makes the whole process safer. Not only is cleanliness common courtesy--after all, you're getting this stuff for free--but it's also a good way to make sure the owner doesn't lock the the dumpster in the future or fly into a fury if he runs out and sees you in his dumpster and trash strewn all around.
If the owner of the dumpster sees you picking through their trash, they will probably be angry, especially if you are making a mess. If they are, do not run. Do not appear guilty. Most of all, do not argue. If they call the cops you will at least be brought downtown, if not arrested, even if the charges are later dropped . As you do not want to go downtown, be polite and respectful while you clean up and leave the scene. Do not go back to that dumpster again as it will almost certainly be locked.