Generally one of two ways, at a foreclosure auction or through an agent once it's listed for sale.
RealtyTrac doesn't sell homes; they sell subscriptions to their services. You can get the same information from a well informed licensed agent.
Buying at an auction can be risky. You can't generally preview the home, you may be stuck with serious repairs, unpaid liens, tenants that you need to evict and you'll be bidding against a mixture of professional buyers and mis-informed amateurs.
My suggestion is to find a great local agent, who knows the area you want to purchase in and look at all the inventory. Some foreclosures are a buy, others are a serious bust. The same can be said of short sales and private party sales. You will do best with a knowledgeable professional on your team.