I thought I'll just add what I learnt in school
Under OECD Model Tax Convention i.e. in respect to taxes on income and on capital
Article 1: This Convention shall apply to persons who are residents of one or both of the Contracting States
Article 15:
1. Subject to the provisions of Articles 16 (Directors' fees), 18 (pensions) & 19 (Govt service),
salaries, wages & other similar remuneration derived by a resident of a Contracting State in respect of an employment shall be
taxable only in that State unless the employment is exercised in the other Contracting State.
2. Notwithstanding the provisions of para 1, remuneration derived by a resident of a Contracting State in respect of an employment exercised in the other Contracting State shall be taxable only in the 1st-mentioned State if:
a. the recipient is present in the other State for a period(s)
not exceeding 183 days in any 12 month period commencing or ending in the fiscal year concerned, and
b. the remuneration is paid by, or on behalf of,
an employer who is not a resident of the other State, and
c. the
remuneration is not bourne by a permanent establishment which the employer has in the other State
Article 4
2. Where by reason of the provisions of para 1 an individual is a resident of both Contracting States, then his status shall be determined as follows:
a. he shall be
deemed to be a resident only of the State in which he has a permanent home available to him; if he has a permanent home available to him in both States, he shall be deemed to be a resident only of the State with
which his personal & economic relations are closer (centre of vital interests);
b. if the State in which he has his centre of vital interests cannot be determined, or if he has not a permanent home available to him in either State, he shall be deemed to be a resident only of the State
in which he has an habitual abode;
c. if he has an habitual abode in both States or in neither of them, he shall be deemed to be a resident only of the State of
which he is a national;
d. if he is a national of both States or of neither of them, the competent authorities of the
Contracting States shall settle the question by mutual agreement.