(a) For individuals, their tax residency will be the main factor in determining where they are liable for tax on their worldwide income and gains. Many countries will deem a person tax resident if they spend over 183 days a year there. Under other residency rules it is possible to be tax resident in more than one country in a year and be liable to tax on worldwide income in those different countries. The use of double tax treaties should mitigate the overall tax payable.
(b) For companies, their tax residency will in most countries depend on where the company is incorporated, or managed and controlled from. It will also include the economic substance of the business being undertaken.