I usually either use manual sizing with some space attached (this can be done with, in increasing order of size, \big, \Big, \bigg, and \Bigg. See below, in the order given, next to the fraction:
\[ \frac{x^2}{2}\big|;\qquad \frac{x^2}{2}\Big|;\qquad \frac{x^2}{2}\bigg|;\qquad \frac{x^2}{2}\Bigg|; \]
To get better spacing, you can use \bigr or \bigm (or suitably sized). \bigl is used for left delimiters such as (, \bigr for right delimiters such as ), \bigm for notation occurring "in the middle" such as \vert (which one it is determines the spacing on left and right); this uses \bigr, etc:
\[ \frac{x^2}{2}\bigr|;\qquad \frac{x^2}{2}\Bigr|;\qquad \frac{x^2}{2}\biggr|;\qquad \frac{x^2}{2}\Biggr|; \]
and this uses \bigm, etc:
\[ \frac{x^2}{2}\bigm|;\qquad \frac{x^2}{2}\Bigm|;\qquad \frac{x^2}{2}\biggm|;\qquad \frac{x^2}{2}\Biggm|; \]
(note the difference in spacing).
Alternatively, you can use the auto-sizing of \left and \right. Each one should be followed by a delimiter of some kind, or by a period; a period means that no delimiter is placed; every \left must come with a \right, and vice-versa, but the sizing is very precise; if you want an oversized bar, you either need to add some vertical phantom or strut to make \LaTeX think your expression is "taller" and/or "deeper". Below I use \left.\frac{x^2}{2}\right|, preceded by \Bigr and followed by \Biggr for comparison:
\[ \frac{x^2}{2}\Bigr|;\qquad \left.\frac{x^2}{2}\right|; \qquad \frac{x^2}{2}\Biggr|; \]
For a bigger one, you can add a "tall" vertical phantom with successive exponents or some other construct; e.g.,
\[ \left.\frac{x^2\vphantom{2^{2^{2^2}}}}{2}\right|; \]
\left. <stuff> \right|to autosize a delimiter to the size of <stuff>, e.g. $$\left.\frac{x^2}{2}\right|_1^2$$ However, this should probably go on the TeX.SE site. – Zev Chonoles Jun 15 '11 at 3:59