Each country/jurisdiction has its own rules that determine tax residency. It can differ in regards to individuals and entities and it is possible for an individual or entity to be tax resident in more than 1 jurisdiction.
For more information on tax residency, please speak to your tax advisor or refer to the information found on the OECD website:
Generally, an Entity will be resident for tax purposes in a jurisdiction if, under the laws of that jurisdiction (including tax conventions), it pays or should be paying tax therein by reason of his domicile, residence, place of management or incorporation, or any other criterion of a similar nature, and not only from sources in that jurisdiction. Dual resident Entities may rely on the tiebreaker rules contained in tax conventions (if applicable) to solve cases of double residence for determining their residence for tax purposes.
For individuals, this varies considerably from jurisdiction to jurisdiction and may include multiple factors like physical presence, ownership of property, nationality, family ties, financial interests or any other factor as prescribed by the local and international laws.