Locks are used to secure bikes. Common varieties are cable/chain locks and U-locks (D-locks).
Questions using this tag should revolve around locks and locking strategies for a bicycle.
A U-lock is a lock which is in the shape of a U. A cable lock/chain lock is a piece of chain/cable with a locking mechanism. Cable/chain locks allow locking to irregularly shaped objects or large objects (such as trees) , while U-locks are primarily for locking against posts, bike racks or similar. Generally, U-locks are lighter for comparable security, though multiple lock varieties can help defeat thieves due to requiring different tools (angle grinders for U-locks, bolt cutters for cable/chain locks).
Proper lock strategy on a standard diamond frame generally requires locking the front wheel, rear wheel and saddle. The rear wheel should be locked such that the wheel cannot be removed. Sheldon Brown claims that locking the rear rim is sufficient as the rear wheel cannot be pulled through the frame and thieves will not cut a rim to steal a frame. Many U-locks are sufficiently long that the rim as well as part of the frame can be captured. It is important to tightly wrap any excess cable/chain or fill up space in the U-lock to prevent tool use (such as a bottle jack). The seat can be locked to the frame with a cable, and the front wheel can be locked with a cable into a rear U-lock (or another U-lock). Generally, the smallest lock / tightest wrapped lock possible is the preferred lock.
Other locking tools include security skewers/bolts, such as Pitlock skewers/bolts, which require special tools to remove those bolts.
Several locking quality certifications exist: SoldSecure (UK), VdS (Germany), etc. are common ones. When buying a lock, make sure to buy from a reputable manufacturer (e.g. Kryptonite, Abus, etc.) and see the appropriate security ratings for your use.