I *personally* do not have experience in this situation (I'll note that I'm a HUGE supporter of fostering and adoption and am working on finding space in our home in hopes to foster--but I also firmly believe there needs to be a system overhaul), but have 2 very dear friends who do have experience in this. Dear friend #1 has adopted 2 little ones who were born addicted to drugs and were brought to them through foster care in not good conditions. It was an up and down, emotional rollercoaster that took years before the little ones were officially their children through adoption. This was because every time they went to court, some random relative would pop up saying they would *think* about taking them (of course nothing would ever come from it), but it would start their whole process and wait over--but, that is what the family is allowed to do, whether or not the rest of us think it is right or wrong to do that, it is the way the law works. They have had the girls in their care for 6/7 years now and do still deal with the neurological and emotional issues that comes with being born to drugs and see a therapist regularly. However, my dear friend could not have been a better placement for those two little ones and is so patient, loving, and giving those two (plus her bio kids and their current foster) the best future set up for success as possible and I know she would go through it all again as they are her babies, but it is not for the faint of heart.
Dear friend #2 essentially met a stranger who got to talking to them about taking care of her grandson and found out my dear friends were working on becoming foster parents hoping to adopt at that time...fast forward a few months later, they got contacted by that stranger asking if they were interested in adopting the little one (I do not believe he was ever in the system, mom and dad waived their rights and grandma just couldn't take care of him anymore). They went through all the appropriate channels and legal ways, but they had left such an impression on that lady's heart that she knew they would be the perfect fit for her grandson and they definitely are--it's even crazy how much their little guy looks like a combo of them, so yes, the stranger approach, though unique, is not completely out of the question, just make sure all proper channels are followed and if the baby is ward of the state, there is really not much anyone can do, especially if you are not currently a foster parent.
Do you have any friends who have adopted or fostered? Sit down and talk to them as to their experiences, who to contact, and don't be afraid to ask hard questions--if this is a possibility, you need to know the facts--good, bad, or indifferent. I have done that with one dear friend #1 and it was very eye opening, but did not discourage me from pursuing this option (actually surprise baby #4 for us is what has currently delayed our process as he has taken up our space we planned for fostering). Also, find out who to contact in your state about taking classes. Typically they are once a week for a series of so many weeks and will answer many questions or give you resources on who to contact. Also, just keep in mind, even if you follow the foster to adoption path, it does not guarantee you will be able to adopt the baby if they are put up for adoption--I have seen that as well where multiple people put in for a child, even one they have fostered in the past, just to be denied the adoption and the child sent elsewhere for adoption--it's all up to the state.