Following the recent changes to UKVI Academic Progression Rules, Tier 4 students who need to do resits or repeats (and are unable to complete their studies within the time granted) are allowed to apply for a visa extension from within in the UK. These students are exempt from the Academic Progression rule.
However, students must apply BEFORE resitting, regardless of whether they have leave remaining on their current visa or not. They will not qualify for an exemption after resitting. If they do resit and then find that extra time is required – they’ll have to return to their home country and apply for another visa to complete their studies.