It completely varies by who owns it and who the lender is.
First step is probably go down to the county courthouse and figure out who owns it now and/or who will own it soon if there's a NOD or NOS on the place. If there's already an NOS and the owner doesn't look like it's going to disagree, it'll just go for sale (depending on the state) at the normal foreclosure auction. That's probably the easiest way to buy it but the price might or might not be what you're looking for.
If there's no NOD/NOS on it (or even if there is), you could try to work out a short sale between you, the owner, and the lender, but these things take forever to finish. And they almost never work out if there are multiple outstanding loans on the property.
An agent isn't really going to be able to tell you much except for past listings and the regular public information. Note that this may not be the owner's only property so at the courthouse, at least do a quick search to see if you can find another address for the owner just in case. The owner is not obligated to talk to you, either way.
If you're looking to buy the note from the bank, good luck. If it's a big bank, it'll be some low level employee answering the phone who doesn't have the authority to do anything with the property and then you'll get the run around forever since the different departments don't talk to each other. Also, the employee has zero upside in trying to sell you the note since they get 0 dollars for doing that extra work. I assume this is regular single family house or similar. Big banks will talk with you but not for the small peanuts. They're more interested in offloading their bigger delinquent loans, such as for apartment buildings, commercial, etc. These days, depending on the bank, you might not get much of a discount if the loss isn't back stopped by the FDIC.
If it's a smaller bank, you might have slightly better luck, but most of them have been gobbled up by the FDIC already. Also, if it's a loan service company that has the note, which has been broken up into 1000 shares in those old MBS days, then you're out of luck since the loan service company has no authority to act on all 1000 "shareholders" of the note.
The best possible case is if the lender is an investment group or person who has the authority to deal with the note but I would say that this is the case <5% of the time. Then, you can talk to them to buy the note for whatever price. Once you have the note, you foreclose on it yourself through the courts and own it afterward. Usual tricks apply here.