Countries come and go throughout history, and territories became part of another country quite often. Martin Luther was German, right? However, the Germany that exists today isn't the same as the one that existed when he was alive; therefore, how did historians decide that he was German? Similarly, anyone living in the United States pre-1776 were alive when the US was still a British territory, so would they be considered British? Or American?
Strictly speaking, we don't. When a historian refers to Martin Luther as German, they are largely referring to the vernacular language he spoke and to some extent the characteristic "culture" of the people who spoke German in Luther's natal community.
This is however a generally tricky problem for historians for several reasons. First, because to some extent the modern discipline of history took shape in national university systems in the 19th Century and played a meaningful role in the dissemination of nationalism as an ideology. National identity and historical analysis have a connection that is hard to discard. Second, because our contemporary readers live in a world of nations. Characterizing people in the past either in terms of the polity they most commonly resided within or in terms of past cultures or communities often requires considerable explanation.
In my own field, for example, I can use the adjective "Zulu" to describe the ruler Shaka, which seems obvious. If I said the South African monarch Shaka, I think most contemporary people would find that a bit confusing or wrong, perhaps not knowing why. In this case, I think this is because the ethnonym "Zulu" is widely known to contemporary people. But it is also in some ways complicatedly wrong: "Zulu" was a relatively obscure group name until Shaka attached to the much larger empire he played a role in creating. If I said "Mthethwa" I would lose almost everyone besides some contemporary South Africans. If I said "Nguni", I'd be using an ethnonym largely invented by contemporary historians to try and describe all the people who eventually were the core linguistic-cultural group in the Zulu state of the 19th Century but also confusingly some people who were not part of the Zulu state, such as the Xhosa of the Eastern Cape.
Most historians who write about individuals before 1750 have some version of this problem to contend with. If, for example, you are writing about a person who lived in Aquitaine at the time that Henry II of England controlled it, what are they? English? French? Both adjectives really don't make any sense. Aquitanian? Doesn't mean much to most current readers. We can use language as a kind of ethnic or national placeholder, but a thousand years ago in many places, people spoke different (or multiple) languages than they do today. We would often call Henry II "English", for example, but he spoke Latin and French almost exclusively.
We so thoroughly live in a world of nations as the only possible political-territorial arrangement that we often project them backwards in time a long distance. But historians are extremely aware of how factually incorrect that is, and of how much ideological work we are doing on behalf of contemporary nations by labelling past people as if they were part of much more recent states. We know that readers often find it annoying or inconvenient when we use what seem like complicated labels or evasions (in my field, for example, referring to "Yoruba-speaking peoples" or "Akan-speaking peoples" rather than calling people just "Yoruba" or "Asante" (or "Nigerian" and "Ghanaian") but this problem is precisely why we do it. Sometimes though we have to bend to what our readers will understand, or we don't want to get caught up in a long, seemingly diversionary discussion of political, cultural and linguistic identities in the pre-national past.