How long can a teacher stay in Thailand after they cancel a work permit?
What should officially happen when a teacher quits a job and hands the work permit back to the employer is that both teacher and employer should go to the immigration department and inform the officer that the teacher has terminated his / her employment.
The officer will then cancel the teacher's visa and the teacher has 24 hours to leave the country. However there are many 'ifs' and 'buts'. If the teacher needs to organise transportation out of the country, etc, - as is often the case - they can ask the immigration officer for a 7-day visa extension (at a cost)
In reality, when many teachers quit their jobs, their employer simply can't be bothered to go and do the right thing at the immigration office and the teacher ends up staying in Thailand for the remaining period that their visa allows.
This is something of a risky game to play because if you, the teacher, are stopped by police for a passport spot-check, you no longer have a work permit to support the visa in your passport.
My advice - do the right thing. Get a one-week extension and then leave the country.