In the modern age of technology, it is an increasingly common situation where a worker has an employment contract with a domestic employer in the state Bosnia and Herzegovina, but takes their laptop to another state and performs work from there for a longer period. Although this is often simply called "working from home", from the perspective of the tax administration, it carries serious consequences.
The general rule of international taxation states: Income from non-self-employment is taxed in the country where that work is PHYSICALLY performed.
This means that your tax obligation, by the logic of the law, does not follow your employer's headquarters, but follows your physical, biological stay. If you are physically in Thailand or Germany while typing code or sending emails, that country on whose soil you stand has the right to tax your work!
The biggest risk of working from abroad falls on your employer. If you regularly sign contracts or have a managerial role in a foreign country, that foreign country could declare your desk in the living room as a "Permanent Establishment" of your domestic company. This would force your domestic company to start paying corporate tax in that foreign country on a portion of its global income! Due to this enormous risk, large corporations strictly limit work outside the borders.
In order to enable so-called temporary "posted work" (when a domestic company temporarily sends you to Germany for work), the A1 certificate system was developed. The A1 certificate ensures that you continue to pay contributions for pension and health insurance at home into your own country while you are temporarily (up to 24 months) abroad. This avoids the foreign country "seizing" you into its bureaucratic health system during a shorter assignment.
The state that will claim the tax principal at the end of the year is identified by your tax residency status. The key is the international 183-day rule: you will be considered a tax resident of the state in which you physically spent more than 183 days (approximately more than half a year) in one full calendar year.