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.
The non-destructive power of masking
Masking can be applied at any level in the Layers panel—as an independent mask layer, applied to a specific layer (or sublayer), to groups, or to individual objects. This is governed by the mask layer's positioning in the layer stack.
Masks can be freely edited and moved, and 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.
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 Fill Tool) across a mask layer and assign different greyscale levels or opacity to end stops to experiment.
To create an empty mask layer:
From the Layers panel, click Mask Layer.
To enable/disable a clipped mask layer:
-click on the mask thumbnail. A red line over the thumbnail indicates that the mask is disabled.
To add a vector mask:
Draw a vector object, e.g., a line or shape, which is to be your mask.
Do one of the following:
In the Layers panel, drag the created object entry directly onto the thumbnail of another 'target' object.
-click the object and select Mask to Below, if the object to be masked is directly below the masking object.
The thumbnail of the target object changes to indicate that a mask and crop have been applied.
The mask of the object is applied in a "crop to top object" operation.