In a layer based app like photoshop, you would place the beauty pass with its transparency ontop of the background plate it will lay over the background nicely.
Well the equivalent to that would be the aptly named 'Over' node - Which has two inputs, one for the background element (the left side of the tree in the image), and the other foreground element (the right side). If the foreground element contains an alpha channel (RGBA) it will use that as its transparency (by pre-multiplying, which can be tricky to get your head around so we won't go into that for now).
In FxTree all the math nodes are selectable in one node named 'Math Composite' which you can see in the image. The node that "Spec_Signs_" is plugged into is set to add.
The first of the math nodes does literally what it says, it adds the pixel values of the two inputs together. We would usually use this to add reflections and specular passes to the comp.
These passes are mostly black apart from the bright highlights/reflections. Adding, effectivly removes the black but doesn't just lay the rest of the image over the background (like an over with an alpha channel) it brightens it.
So if we pick a random pixel on the background image, it will have 3 values from 0-255 for each colour channel (Red, Green and Blue). But for now we will just assume they are the same in each channel, so one value from 0-255 where 0 is black and 255 is white.
Now this is why the black pixels are effectivly removed with an add node, as any pixel value + 0 (black) will remain the original value. But any value greater than 0 will brighten the background pixels:
bg + fg = output
50 + 0 = 50 (no difference)
128 + 205= 255 (as colours will be clamped at 255, pure white)
190 + 55 = 245 (brighter)
Hopefully that didn't sound too complicated, but its also the base for the other math nodes so it should have got a lot covered.
The Multiply in the tree above is the 'Math Composite' which the 'AO_' is plugged into.
Kind of the opposite to add, using Multiply removes the white from an image. Now for multiply I've found it best to consider the pixel values normalised, so the proper range of 0-255 is now 0.0 to 1.0
So when multiplying a Ambient Occlusion pass for instance, we want to remove all the white and keep the darker areas.
Remember, black = 0.0 (0), white = 1.0 (255)
bg x fg = output
50 x 0.0 (0) = 0 (black)
128 x 1.0 (255)= 128 (no difference)
190 x 0.22 (55) = 41 (darker)
So multiplying white pixels has no effect, but for anything less than 1, it darkens the pixels.
Other Math Nodes:
Multiply, Add and Over are the main layering nodes that you'll need to use, while there are other common nodes, including 'Screen', 'Subtract' etc. I won't go into these, have a play for yourself if you want to see what they do :)