Whether you are new to Photoshop or a seasoned pro, you need to understand how to use Layer Masks. These special masks reside with the Layer and allow you to reveal or hide any portion of that Layer. Layer masked are completely editable and non-destructive to the actual contents of the Layer.
Adding a Layer Mask
With the Layer selected, simply click on the Add Mask icon to add a blank Layer Mask. In the Mask, pure black hides the layer contents while pure white reveals the layer contents. Greyscale levels in-between reveal or hide in gradations. Simply click on the Layer Mask to draw on the Mask. Click back on the Layer icon to draw on the layer contents.
Disable the Link to Transform either the Layer or the Layer Mask Independently
In between the icons for the Layer and its Layer Mask is a Link icon. With the Link in place, transforming the Layer will also apply to the Mask. However, there are times when you would want to manipulate either the Mask or the Layer independently. In the above screen capture, the Link is disabled. I clicked on the Mask icon and dragged the Mask to a new location.
Still with the Link disabled, I clicked on the Layer icon and transformed only the contents of the Layer. The Mask remains intact.
Replace Mask completely
You can even replace the Layer Mask completely without altering the contents of the Layer. In this case, I clicked on the Layer Mask and dragged it to the Trash. I then loaded a selection based on a clipping path of the window frame. With the selection active, I simply clicked on the Add Mask icon to add a new Layer Mask based on the selection.
Refine Masks even further
Photoshop CS4 added a new Mask Panel with additional controls (available from the Windows drop-down menu). Now you can Refine the Mask just like you can Refine the Edge of a selection. You can even adjust the Density of the Mask Layer directly (similar to adjusting the Opacity of the Layer itself).