Tax residency decides whether a country taxes your worldwide income or only income from that country. Day counts, home and family tests, treaty tie breakers, and how residency differs from citizenship.

Every country needs a rule for deciding whose income it may tax, and that rule is tax residency. It is the legal link between a person and a country for tax purposes, and it decides how much of your life that country's tax net covers.
The difference it makes is large. A resident is usually taxed on worldwide income: salary, business profits, rents and gains wherever in the world they arise. A non resident is usually taxed only on income from that country, such as a salary for work done there or rent from a property there.
Once a country counts you as a resident, it generally expects a tax return from you and taxes you much like one of its own long term inhabitants. Leave residency behind, and the same country mostly loses interest in income that has nothing to do with it.
The best known test is a simple day count. Spend more than a set number of days in a country in its tax year, often around 183 days, and you are treated as resident there. The number is easy to picture, which is why it is the test travellers and remote workers hear about first.
In practice, most countries look at more than the calendar. Where your permanent home is, where your family lives, where you work and where the centre of your life sits can all count, sometimes alongside the day count and sometimes instead of it. Two countries can apply their own tests honestly and both conclude that you are resident with them.
Dual residency sounds impossible, but under two sets of national rules it happens regularly. This is why tax treaties between countries carry tie breaker tests, a short ladder of questions about your home, your closer personal and economic ties, and where you habitually live, designed to assign you one single residency for treaty purposes.
Residency is also separate from two things it is often confused with. It is not citizenship: a citizen living abroad may be non resident for tax at home, and a foreign citizen may be fully tax resident where they live. And it is not immigration status: a visa decides whether you may live in a country, while the tax rules decide whether that country taxes you as a resident.
That is why people who move between countries take advice on residency before they move rather than after. The pattern of your days, your home and your work in the year of the move can change which country taxes a whole year's income.
Residency decides which country calculator applies to your worldwide income. Open the calculator.