A layer mask is used to reveal a portion of a layer while the rest of the layer remains hidden. This means that you can use a mask layer to 'delete' areas of a layer that you don't want.
Masks are applied as a separate layer, allowing them to be freely edited and moved. Mask layers affect any object below them within the same parent layer. They can also be clipped to individual objects so that only that object is affected.
Adjustment layers also have mask layer properties. Areas of an adjustment layer can be revealed or hidden in the same way as with a mask layer.
Once a mask layer is created, you can apply different levels of greyscale or opacity to the mask layer—apply White (or 100% Opacity) to reveal; apply Black (or 0% Opacity) to conceal; apply intermediate greyscale levels for partial masking. Try drawing a gradient (with Gradient Tool) across a mask layer and assign different greyscale levels or opacity to end stops to experiment.
Mask layers can have blend modes assigned to them.
The masking object is clipped to the target object using a "crop to top object" operation.
The masking object can be a group of objects which will remain as independent objects after masking; the group can be expanded/collapsed and its objects will remain editable.
On the Layers panel: