Lubricating door locks is an easy effective way to get them working smoothly. The door strike can be lubricated with the lock or knob still in place. Use some silicone spray and work the knob back and forth until it moves freely. The same may be true of the lock tumblers. Spray some lubricant inside the key hole. Use the key to work the tumblers until the oil sets in and the lock works.
The other moving parts of the lock will require that you remove the cover plates to lubricate them. Most locks are held together by two machine screws. The heads usually face the inside of the door. Residential grade locks can normally be taken apart with just a screwdriver. The lock should come apart in two pieces. The strike mechanism can stay in place once the knob and cover plates are removed.
Lubricate all the moving parts and work them until they move freely. Re-assemble the lock and the door should work. An old badly corroded lock or a broken lock, will probably not respond to just oiling it. A lock that is too far gone will need to be replaced. Check Step Six below for information on replacing a lock.