Some expanding on the questions: For example in game Europa Universalis IV, by playing specific nations and doing specific things you can form another nation. Eg. The game tells you "Be Prussia, conquer these provinces" click a button and bam you are Germany.
But in real life stuff like that isn't that simple. How did the rulers know what they needed to "form" a country? What determinated it? How did they tell everyone else that their nation is now something else?
It goes without saying that changing the name of the polity is more than just a symbolic gesture and is often associated with varying forms of legal trappings. Forming a country, as in Europa Universalis IV (full disclosure, I have over a thousand hours in that game), is an abstraction, much like Mercenary Limits or Autonomy percentages, so I think it's useful to go over a few historical examples, starting with "formable" countries that feature in the game.
The simplest type of formable would be external conquest and the subsequent assimilation of the conquerors, i.e. Mughals, Yuan, or Qing. These "formations" represent the assimilation of the conquerors through sheer attrition; they were all conquests of highly populated, urbanized regions with rich cultures (Northern India/China respectively) by outsiders whose dominance were only in military prowess. By the time of the "formation" of Mughals, Timurids were essentially collapsing as state, mostly due to infighting. They were Turkic, and though not exactly steppes people like their northern brethren, had to do a lot of adaptation in order to be able to rule the peoples they have conquered. The same is the case with Qing, which is essentially the assimilation of Manchus, a nomadic steppes people, into the city-dwelling urbanite Han Chinese with their own court rules and traditions. So one type of "nation formation" is essentially external conquest and the subsequent naturalization of the conquerors. Other historical examples would include the Sultanate of Rum, the Anatolian spin-off of the Turko-Persian Seljuk Empire, which promptly intermingled with the local Anatolian Greek population. In this case, the legitimate claim to a new title would be that the conquerors are now a native part of the local culture and administration, no longer to be considered outsiders.
Another type is one that was common in Europe due to the concept of personal unions. Christianity was unique in world religions for its call for monogamy no matter status, and while this was far from enforcable, it played a big role in the legal system and the subsequent dynastic succession. As a result, political marriages, while not strictly a Christian thing, resulted more often in both the chaotic maps you see of the Holy Roman Empire, and the occasional unions. The Acts of Union in the beginning of the 18th Century formed the United Kingdom of Great Britain, which used to be a personal union of England and Scotland, led by the Scottish House of Stuart. Spain and Prussia were formed in a similar manner, as fusions of two relatively-equal partner nations in a personal union, often as part of a centralization effort by the incumbent monarch. It helped that Spain and (United Kingdom) of Great Britain were clear geographical constructs, though the exclusion of Portugal from an entity that caused itself Spain caused some consternation, considering Spain used to be the name for the whole of the Iberian Peninsula. Prussia, like the Kingdom of Sardinia, was adopted by the senior partner for legal reasons. Both allowed their monarch to call themselves "King", rather than "Duke", as the otherwise larger Duchy of Savoy was part of the Kingdom of Burgundy, which itself was a part of the Holy Roman Empire, and so the more prestigious title of the smaller territory was chosen. The business with Prussia and its King in Prussia rather than King of Prussia was also a result of complications with the Holy Roman Empire. It goes without saying that personal unions didn't always lead to real unions, and indeed, the opposite could happen, as was with the case with Austria-Hungary, a country that was "formed" outside the game's timeframe, but was an emergency measure in a time of crisis as an alternative to full Hungarian independence.
The last type I suppose at least I could meaningfully distinguish is the formation of nation states, such as Italy, Germany, Bharat, Hindustan, Malaya and the reformation of France and some other countries should they ever be removed from the map. These represent a broad form of nationalistic "cultural unions", in terms of the game, and they are slightly anachronistic as well as a gameplay element more than a historical possibility. That said, Kingdom of Italy and Kingdom of Germany existed as parts of the Holy Roman Empire, at least nominally, so their formation into nation-states isn't implausible. After all, at the level of the game's abstraction where France is basically a nation-state starting in 1444, it's difficult to say if a unified Germany or Italy really means how we think of them starting from 19th century on, or if that simply gets lost in the abstraction the game presents.
Hope this helps.