Photoshop masking explained

(From http://digital-photography-school.com/hdr-post-processing-beginners-guide-to-hdr-photography-part-3)

What is masking?

Well, masking is really one of the most powerful tools in Photoshop. Masking allows you to select certain parts of a layer to show up, while hiding other parts of that same layer. It’s a way of erasing parts of a layer without permanently erasing them.

If you place a white mask over a layer, everything on that layer will still show up, nothing will disappear. If you begin painting on that layer mask with a black brush, every stroke you make will hide that part of the layer, revealing anything beneath that layer.

On the flip side, if you place a black mask over the image (by holding “option” or “alt” when clicking the mask button) you will cover up the entire layer and fully reveal the layer beneath it. When you paint on that black mask with a white brush, every stroke made will reveal the layer with a mask over it.

A good way to remember masking is to this: Black conceals while White reveals.