Overstaying means allowing your immigration permission to expire whilst you remain in the UK. The immgration rules define 'overstaying' as meaning a "person has stayed in the UK beyond [...] the time limit attached to the last permission granted [...]".
Overstaying is a criminal offence. There is no period of time for which you can lawfully overstay.
If you submit a valid application for further immigration permission before your current immigration permission expires, and your application is still being decided (is 'pending') when your current immigration permission expires, you will not be considered as an overstayer in the period of time after your current permission expires. Instead your current immigration permission, and the conditions attached to it, will continue while your application is pending.
If you do not submit an application before your current permission expires, you become an overstayer. If you then wish to make a new Student application in order to remain in the UK, your Student sponsor may choose to not issue you a CAS in order for you to do this, and it may withdraw any unused CAS that you were issued before you became on overstayer. Seek advice from your Student sponsor about its policies on issuing CAS to overstayers, and on whether someone who makes such an application can continue to study with it.
Overstaying will have serious consequences for any future immigration applications that you make. If you overstay by more than 30 days you will normally be prohibited from coming back to the UK for at least 12 months from the date you leave the UK. Overstaying in the UK could also affect applications you make for entry to countries other than the UK. You must tell the truth in immigration applications and declare any periods of overstay if asked about them. If you are found to have used deception in an immigration application you are likely to be barred from the UK for ten years.
If you need more time in the UK to complete your studies, see Making a Student route application in the UK.