I've failed my first assignment/ unit: what can I do?

Disappointing as it is, failing is a normal part of learning and experience. Don't waste the effort you have already gone to: there is no need to withdraw completely! Learn something from it.

More specifically

See those options discussed under What can I do if I can't understand the mark I got on my assignment?

More broadly