As I was thinking about and writing your answer, I listened to General Conference and some of those talks (especially President Eyring's Saturday morning talk) seem to answer your question perfectly. However, since I've already put enough effort into my answer that deleting it makes me sad, you can either read his talk, read my answer, do both or read neither. Your choice!
I'm hoping the "friend" is actually you because otherwise the "how do I not blame God" when it's your friend's thing is weird. And none of your business. Because God's plan for your friend doesn't have to be your plan. Do you get mad at God when your friends don't get into the university of their choosing or aren't accepted for a job they want or even if their sports team loses at an event? I would imagine not.
Now if the "friend" is actually you, or even if the friend isn't you right now, I can guarantee you're going to face some major disappointments in life; it just happens. I think it's okay to tell God how angry and disappointed you are by the situation. He gets it. He knows you're hurting and can handle hearing you say it. Sometimes life really, really sucks and it's okay to acknowledge that.
On my mission my companion made me play a game called "It Actually Works Out Better." When something went wrong, she'd say, "It actually works out better because..." and make me finish telling her why it worked out better. Admittedly it was a mission, so the most disappointing things were missed appointments or getting lost in unfamiliar towns, but the habit stuck and now I automatically try to see how things are actually working out better. For things as big as an unexpected career falling through it might not be as easy. As Zora Neale Hurston said, "There are years that ask questions and years that answer." Some trials take time and perspective to see how they actually worked out better.
For FHE the other week, my roommates and I read Elder Holland's "Lessons from Liberty Jail" which is very applicable for your friend. In this talk he compares Liberty Jail, an undeniably difficult and unpleasant experience for the men who were there, to a temple in that it's where Joseph Smith and those with him grew and received inspiration and knowledge. Elder Holland also teaches us:
Furthermore, we note that not only has the Savior suffered, in His case entirely innocently, but so have most of the prophets and other great men and women recorded in the scriptures. Name an Old Testament or Book of Mormon prophet, name a New Testament Apostle, name virtually any of the leaders in any dispensation, including our own, and you name someone who has had trouble.
My point? If you are having a bad day, you’ve got a lot of company—very, very good company. The best company that has ever lived.
As Elder Holland points out, your friend isn't the only person seeking to do God's will who has suffered or experienced disappointments. That doesn’t mean it isn't difficult, but it's not a sign that God hates you or a reason to hate God.
I love this statement by Larry Crab: "The battle is not to improve our circumstances, to supply us with money, to protect us from suffering, to keep us safe from pain and struggle, or to quickly fix whatever problems develop in our bodies. We are encouraged to pray for all these things, but we must always finish our prayer with that wonderful caveat that in our immaturity we find so annoying: if it be Thy will."
It's not wrong or bad to try to get inspiration and follow it, but you must be ready to accept that it may not be what God has in store for your life. In fact, the times we grow the most are when things don't go the way we'd planned.
The talk "Decisions For Which I've Been Grateful" by Elder Clayton Christensen may possibly be my favorite talk of all time. In it, Elder Christensen talks about how he gained his testimony by committing to read the Book of Mormon every night from 11 o'clock to 12 o'clock in order to know if it was true. He then talks about gaining his testimony, but my favorite part of the talk is this part where he says:
I love to return to Oxford. Most of the people there are either students or they’re tourists who have come to look at a beautiful university. But I love to return there because it’s a sacred place, and I can look at the windows of that room where I lived, and I think that that’s the place that I learned that Jesus is the Christ, that he is my living Redeemer, and that Joseph Smith was the prophet of the restoration for the true church. I just wanted to tell this to you because some of you probably came here to Rexburg already having learned for yourself that this is God’s church. But for those of you that may still be living on the testimony of others, I invite you to set aside an hour every day and find out for yourself if this is true, because it will change your heart as it has changed mine. And someday you’ll be able to come back here to Rexburg, and whereas other people are here for many different reasons, you’ll be able to go to the place where you lived at the time that God revealed this to you, and point at it to your children and your spouse, and say “That’s a sacred place because that’s where I learned that Jesus is the Christ.”
This is my favorite part because I know what he means. I expected to get married and never, ever, ever in a million years wanted to go on a mission. Instead, I realized I needed to go on a mission though it wasn't what I thought I'd wanted and certainly not what I'd planned. I know the exact location (the flat I was in for the first nine months of my mission) where I also gained my testimony, and I gained it not in spite of it being hard and stressful, but because of it.
I love the beautiful poem by Ella Wheeler Wilcox entitled “Gethsemane.” The last stanza, particularly, expresses a thought you might find helpful:
All those who journey, soon or late,
Must pass within the garden’s gate;
Must kneel alone in darkness there,
And battle with some fierce despair.
God pity those who cannot say,
“Not mine but thine,” who only pray,
“Let this cup pass,” and cannot see
The purpose in Gethsemane.
I have a lot of friends and family members who have experienced disappointments when things didn’t go the way they’d hoped or planned. Recently I was talking with a friend about your question. She wanted me to share her story:
My senior year of high school, I was diagnosed with a brain tumor and had a six-and-a-half hour brain surgery two weeks later. Obviously this trial threw my entire life into a spin. I was in a wheelchair for two months. I had to relearn how to walk and to deal with extreme nausea caused by extreme double vision. I couldn’t see for the entire second semester of my senior year. I didn’t think life could get much worse. Anything I had planned for my life was changed instantly. Everything important to me, especially with regard to school and sports, could no longer be a part of my plans. I too had feelings of “Why is God doing this to me right now?” But looking back on the experience, I realize it was not a trial but a blessing in my life—for many reasons. For one, I really learned what it’s like to have to completely rely on the Lord with full faith and to accept whatever plan He had for me. Secondly, I learned the importance of families and how much they mean to me. Third, I really learned how to be humble and realize it’s okay to ask for help sometimes. Lastly, I ended up completely changing career plans as a result of this surgery, and I am now on a path I couldn’t imagine my life without. So tell your friend to just keep holding out strong, and have faith that God has a better plan for him than he may realize. Advise him to read his patriarchal blessing often if he has one (and if not, tell him to strongly consider getting one), and to remember that God will never give him any trial that he can’t handle—which means God must really think a lot of him if He knows your friend can handle whatever he is going through.
My list, as well as everyone else’s list, could go on and on. I have a former coworker who was disappointed that she didn’t make it into the Tabernacle Choir last fall (she got really close, though). Shortly after that she got a job promotion that took up a lot of her time. It actually worked out better for her because she was able to accept that promotion.
Especially inspiring in my own life is how my mother couldn’t have children, which is what she planned to do with her life, and instead had to wait 16 years to get my sister and me. Sixteen years is a long time to see the reasons for the delay, but she’s probably one of the most amazing and influential women I know.
Sometimes I think about the idea of getting everything I ever wanted or planned for, but then I look back on the things I didn’t get and the things I got instead, and I realize they actually were better for me. Why would I want to limit my blessings with the things I can imagine when God can plan something so much better?
The bottom line is that God is watching out for your friend and for you and for all of us who put our faith and trust in Him. We should not try to second guess Him. He knows the end from the beginning and knows what is best for all of us. I love this quote, which I feel is very pertinent to your question, from Elder Richard G. Scott: “Ask, and ye shall receive” does not assure that you will get what you want. It does guarantee that, if worthy, you will get what you need, as judged by a Father who loves you perfectly, who wants your eternal happiness even more than you do.
-Marguerite St. Just