I suggest that if you really want to learn all the ins and outs of foreclosures, that you buy one of the many books out there. It's way too involved to answer under this forum, although the previous correspondents have done an excellent job in giving you the basics.
Work with a buyer's agent who can help you navigate today's market. It's not just about foreclosed homes, but short sales as well. And as Jim said, these 'bait and switch' advertisements online are confusing to say the least. But if you really don't want to talk to a buyer's agent, then get a book or two. That will get you started on the foreclosure world, but won't give you the strategies to employ in order to buy one in this market, like working with a buyer's agent.