So, you've arrived at the end of the semester, and you've failed a final. Worse still, maybe you failed the final, and that prevented you from passing the class. You're stuck retaking a class in the summer or fall, and now you feel like you're falling behind your peers. I know it's easy to get down when this happens; there are a couple of things I want you to keep in mind, though.
You're not a failure because you didn't get through a class on the first try or any try. I don't care what class it is you didn't manage to get through. You are not any less of a human being because you lost this round. Take it from a guy who has had his fair share of retakes in college. It may knock you down for a little while, and your ego might take a little hit in the process, but you'll get up and go again.
Take it as a lesson, and grow from it. Chances are good there's a reason you didn't do as well as you had hoped you would, and, more often than not, it has nothing to do with your brain power. Did you skip class a lot? Did you hardly ever study for the tests? Maybe you rarely (if ever) took notes during lectures. Whatever the case may be for your class, there's usually an issue with your methodology. Learn how to manage your time, and make plenty of time to prepare for whatever the class throws at you. It all goes a long way towards your success.
Don't let it keep you down long. When I hit my lowest semester of college last semester, I felt like I'd finally hit the lowest floor I could. For the first time since I had started at UAH, I wondered about, and seriously considered, switching out of engineering into some other major (e.g. biological sciences). I was down and out for at least a month following the end of the semester, but I got back up again. I redoubled my efforts, and now my grades are back up to snuff with what I feel they always should have been. Moral of the story, I made it out of the slump by not giving up. There's no reason you can't do the same thing.
Never give up, and never give in. You may have failed a final, but your life isn't over. Your college career isn't totally derailed; get back up and go again.