If there are any medical circumstances or similar (so you can get a doctor's note etc) then your tutor will be able to appeal to the university on your behalf for you to "degrade" or "intermit". This means that, whichever stage of the year you are at the time, you stop, leave college (you are not allowed to stay in residence) and go away to be treated. You will then need another doctor's note, declaring you fit to resume your course, by the end of August preceeding the October when you will return. E.g. in my case I went to a doctor quite late - in May, only 3 weeks before the actual exams. She declared me unfit to take them, a letter was written and passed on to the university via my tutor. In the last month I have been back to see my doctor, who has had to fill out a form declaring me fit again. This had to be returned to my college by 31st August in order for them to forward this on to the university, allowing me to return at the beginning of the coming term. IF I had not been well enough in time to get all this done before the end of August, I would have had to wait another year away from the university before completing that same process in order to return next October.
Basically, if you are disadvantaged because of any personal/medical reasons that are verifiable (by a doctor, or the university counselling service, or similar) then the university will allow you to come back once the problem has been resolved so that you may come back to the course without that disadvantage. The university will not usually allow someone to degrade twice though.
In cases of people who are struggling but without any mitigating circumstances, you will usually find that 1) your supervisors will know you're not doing well, 2) they will have told your DoS, 3) your DoS will discuss this with you, and then 4) arrange whatever extra help they think you might need. This could mean extra supervisions, or even just helping you to work out a strategy for the exams :that might mean, for example, helping you to choose which bits of the course will be most beneficial for you to focus on in order to maximise how many marks you can get in the exam (having a strong knowledge of half the subject instead of a sketchy knowledge of everything), or helping you to organise a revision plan.
In most cases your DoS will have played at least some part in your admission to the university (for me, my DoS happens to be the admissions tutor. For most, their DoS will have been involved in one of the interviews or similar). You'll find them reluctant to give up on you too quickly - they wouldn't have let you in if they didn't believe you could do it.