Depends on the hill. If it's a slow upgrade, spinning in the saddle is best. If it is a quick burp (read: big uphill), I'll often start in the saddle and finish out of the saddle. Before standing, I shift to one harder gear - that way I'll always have an easier gear if I need to sit.

It never occurs to me that I wont' get up the hill. When I get out of the saddle, I think of it as dancing on the pedals (I think I got this from a Lance Armstrong book or something).

Another thing - approach the hill as quickly as possible. Momentum is your friend!