A.L.
Ah that sucks, I am sorry for you.
If you have not yet, go see an adviser at your school. They will be helpful in assessing what happened and make a plan with you.
Do you know what the reason for failing was? Where you not well prepared? Are you not a confident test taker? Are there other reasons that played a part (illness, stress at home...)?
I would start by doing an honest self assessment. If there are temporary reasons like illness or stress that played a role, maybe waiting a bit or asking for help to deal with this will help.
If you were not well prepared you know what to do... you just have to buckle down and do it. If motivation is an issue you could consider signing up for a prep course. They are pricey but often spending that extra money is an additional motivator and many people feel more motivated if they study in a group.
If you have test anxiety there are strategies to deal with that. Speak to a counselor at your school about how you can counteract your anxiety (meditation, self-hypnosis, preparation and practicing under "real" conditions can help).
Last but not least - I do see some students who frankly just don't make the cut. I don't say this because I want to discourage you (and I don't know whether this applies to you - only you do), but because it is the truth. In real life not everyone gets a trophy and sometimes failing a test really is a reflection on a student's lack of ability. Sorry to be harsh, but it happens.
The licensing exams are hard for a reason: people's lives depend on your skills in your profession. I often see students who have just squeaked by with passing grades in their coursework get a reality check when they take the NCLEX... it is the last step of weeding out people.
If you see yourself in that description (just passing or average coursework) I would suggest that you explore whether this is a profession that you REALLY want and whether you honestly have it in you to succeed in this.
There is a stigma attached with "giving up" on something that you have started (in this case nursing school) and often people will give the advice to "stick it out". I don't think that that is realistic and I see an awful lot of students wasting a lot of money and time trying to "stick it out". It doesn't work for nursing, you don't just graduate with a C average - if you cannot master the material you won't get through licensing. IMO, and that is what I advise my students: be honest with yourself. Sometimes it may be better to cut your losses and pursue something you can be successful at. There is no shame in choosing to do something that you are good at over something that is an ongoing struggle and you barely keep your head above water. Again I don't know that that is the case for YOU, but thinking about this should be part of your self-assessment.
So lick your wounds for a little, be honest with yourself and if you really want it and are up for it you either try again or you have some decisions to make.
Good luck.