Advice on buying junkyard engines?

How do you avoid buying a piece of trash?

Others have chimed in with practical advice. This is more on the philosophical side: factoring in the price you pay and the general reputation of the kind of motor(s) you're after, keep your expectations on the low side of realistic. That way you're more likely to be pleasantly surprised than bitterly disappointed.

When I worked at the yard we countermen had little games we played to stave off boredom. One of them: answer the phone and if the caller says "Got a [whatever model of '87-up Mopar FWD car or minivan] or [Ford Taurus, Mercury Sable]…", interrupt and say "Sorry, we don't have a good 3.0 V6 or 4-speed automatic for you". Occasionally they'd say "No, I need a [some other part]", but mostly they'd say "Okeh, thanks" and hang up.