Tl;dr it's much more about EU law than UK law
1/
Can also ask for extension to departure period.
In both cases, domestic process for doing these things is left to that state
2/
For past extensions, UK gvt just sent a letter to President of European Council
3/
4/
5/
UK cannot unilaterally decide to extend and MUST have accord of all EU27
6/
/end