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.
That is all good and well, but coming back to the Lightning example, how can we utilise our knowledge of the render order in Adobe After Effects to solve the problem? We can pre-compose the layer and the lightning effect (without the mask) and then apply the mask to the final composited layer.
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.
The render order in Adobe After Effects has a profound impact on how the visual elements in your composition are composited. And while you can't change the render order, knowing how it works will allow you to use it to your advantage.