Most bathroom doors in homes have either a button lock or a turn lock. Inevitably someone is going to accidentally lock the door as they leave the bathroom and shut the door. Fortunately, either of these locks are readily unlocked from the outside. The turn lock takes a little maneuvering to unlock, while a push-button lock only requires engaging a hidden button that pushes the outer button to unlock the door.
Find a large paper clip and straighten out the end. This gives you a handle with a straight end. If a paper clip is not handy, find a small finishing nail or other small diameter straight object that fits inside the hole on the bathroom door handle.
Insert the straight part of the paper clip or other straight object in the center hole of the door knob. Insert straight into the hole until you feel resistance.
Hold the door knob in one hand and press against the resistance with the paper clip in your other hand. When you hear the "pop" of the bathroom door lock unlocking, turn the handle and open the door.