Autoxer is right that pre-foreclosures are the way to go if you can, but finding them can be tricky and lots of banks aren't as willing to negotiate as you might think. (IE, if the house is in pretty good shape they think they can get full market value.) The best way I know to find these pre-foreclosures (in my market at least) is to have your agent do a search a under "agent remarks" for "bank" or "corporate". If the sale requires "bank approval" it's probably on the market as a short sale (pre-foreclosure).
In the meantime, that same search (also search for "as is" and "as-is") will bring up most of the foreclosures that are back on the market. These will be listed with agents that will know how to sell a foreclosed home. It seems there are some that do nothing but that. Don't touch the courthouse steps with a ten foot pole. It's not a place for novices. Trying to contact the bank directly after the foreclosure but before the house is listed might work, but in my experience the banks have their way of doing things (listing with agent x) and anything out of the ordinary doesn't work even if it saves them money. Of course, it's worth a shot
Princess is right that many of the foreclosures you look at will be trashed. Learn to look beyond the stuff that's cheap to fix and you might just get a deal.