UK residency is determined based on a combination of factors and the application of the Statutory Residence Test (SRT). Here is an explanation of how it works.
When living overseas, understanding the difference between domicile and residence is critically important. Unfortunately, the two are often confused. The resulting tax implications can be significant and wide-ranging.