One thing that tends to throw people off when they start to work with effects and masks in After Effects is that they sometimes don't get the result they were expecting. For example, if you add a lightning effect onto a layer and then draw a mask over it, you will find that the lightning is not constraint by the shape of the mask.
The reason for this is the order in which After Effects renders the visual elements in your composition. This is determined by the Render Order. You cannot change the render order in After Effects, but understanding how it works will equip you with the knowledge to solve common issues like the one above.After Effects renders the layers in your composition from bottom up. This allows After Effects to composite the layers higher up onto the ones below them. For each layer, it first applies any masks (in the order they appear on the layer) and then it applies any effects (in the order they appear on the layer).
If you expand any layer in your composition you will see the masks and effects on it laid out in the order they will be applied from top to bottom: masks, then effects, then transformations.
Here is another example of where the importance of render order in After Effects is very obvious. In this case however, it works in your favour. Assume you have cut out an element on your layer using a simple mask. You now decide to add a Glow effect to the element you separated.
Because After Effects will apply the mask first and then apply the Glow effect over the resulting layer, the Glow itself will reach beyond the boundaries of the mask. In this case, that is likely what you'd want it to do.
After Effects will render the contents of the Lightning Comp layer first before it applies the mask. Therefore it will render the lightning effect onto the layer and then apply the mask to the result, thereby restricting the lighting effect to the boundaries of the mask.