Fix a locked door by first jimmying the lock. Using a thin, flat, but sturdy item–like a credit card or putty knife–attempt to access the angled side of the door latch and push it into the door’s recess. A door latch is designed to recede into the door while the lock simply prevents the door handle from turning. Using the flat, sturdy tool to jimmy the lock will allow the door to be opened and allow you to skip Step 2 below. Keep in mind that not all doors can be jimmied; entry doors and doors with a tight door jamb may not allow entry of the jimmying tool. In addition, a deadbolt can not be jimmied.
Remove the old lock. Locate the screws holding the lock in place on the inside of the door. If the malfunctioning lock is in the door handle, there will be at least two screws securing the door handle to the door; remove these screws, unscrew one side of the door knob, and pull the door handle and lock assembly out of the door. The process for removing a deadbolt is similar, but does not require unscrewing the door handle and may only require removal of a single screw.