I was in the same situation for one of my courses. Was on the verge of failing and the (optional) final would replace our lowest midterm grade.
Honestly, at that point, all there is to do is study your ass off for that final. That's what I did. Spent two days before the final reading through the textbook, retaking notes, and going over the previous exams. It paid off. Got an 84% on the final and passed the class!
But also... failing one class won't ruin everything. I failed a class my first semester and I was terrified that I'd lose my scholarships and not be able to continue my education. That didn't happen. If your GPA falls under what the scholarships require, they give you a cushion semester to bring it back up, I've learned. Things happen. They try to understand. You'll be fine, just try harder next time around. And personally, it was very satisfying to have to go from a 32% (F) the first time I took the course to a 90% (A) when I retook it. Obviously don't wanna retake a course again, but it was a great learning experience for me when I failed that class.
>>3Some courses do require a C to pass, though, as was the case with the one I almost failed, cause I had a D before the final.