LaTeX's delimiters are way too complicated
I've just discovered today that the way LaTeX handles delimiters, like (, ), [, ], is very very complicated.
Basically, those delimiters can be treated in two ways (or two types):
Ordinary atoms: as the name suggests, they are just ordinary atoms and there is no special handling taken.
Open and close atoms: they open and close some inner atoms, for example in cos(x), the delimiters ( and ) open and close the inner atom x OF the operator cos.
The visual difference may not be too obvious. In the first case (ordinary atoms), there is often some thin space before/after the delimiters. In the second case, there is none (space = 0). So, using the same example cos(x):
Ordinary atoms: there is some thin space between 'cos' and '(' and between ')' and what follows. This is undesirable because it detaches the operator cos and its parameter.
Open and close atoms: there is no space between 'cos' and '(' and between ')' and what follows. This is desirable because the contents inside the parentheses is the parameter of the operator cos.
Surprisingly, \left and \right produce ordinary atoms instead of open/close atoms.
\left, \right, \big, \bigg, ... produce ordinary atoms.
(, ), [, ], \lvert, \rvert, \lVert, \rVert, \bigl, \bigr, \biggl, \biggr, ... produce open/close atoms.
Avoid using \left, \right after operators.
After an operator (such as cos, sin, log, sum,...) whose parameters are the inner contents of the delimiters, use the plain delimiters or their \<size>l, \<size>r friends, so that open/close atoms are produced correctly.
Note that the matrix environments (bmatrix, pmatrix,...) use \left, \right (producing ordinary atoms).
The package mleftright might be of interest. It defines \mleft and \mright to produce open/close delimiters for \left and \right. It provides a command to re-define all \left and \right to \mleft and \mright.
http://tex.stackexchange.com/questions/2607/spacing-around-left-and-right
http://tex.stackexchange.com/questions/19480/why-the-control-sequences-bigl-biggl-bigr-or-biggr-as-i-can-always-use-b
http://tex.stackexchange.com/questions/23640/how-to-input-open-intervals