There is a literature on the size of nations, and therefore on their number, with some of the best work arguing for an emphasis on the tradeoff between heterogeneity and economies of scale. If we think of modern history as consisting of a long period of consolidation, or merger of nations, followed by a period of dismemberment, independence movements, or increased numerosity, then the story is one of technological changes that made increased size more valuable and then less valuable. (The facts can be disputed, if only because there is room to argue about the definition of a country. But this is not the place.) Alternatively, preferences might have become more homogeneous and then less so. If we think of preferences as including a taste for peace, or something else that might be cheaper to achieve with greater country size, then the analysis can get a bit circular even as it gains plausibility.
In future work I plan to connect the question of country size (and number) with that of the popularity of federations, or multi-tiered government, within countries. I will sketch one part of the developing theory here and hope for comments. A starting point is that (immobile) resources are not spread evenly across regions, so that when one part of a country is rich (as from salt deposits (long ago) or natural harbors or oil reserves), it will prefer to be on its own in order not to share its wealth with a larger group. I will assume that it is efficient for ownership, or defense and exploitation, of the resource to be at least partly local. But of course these pockets of wealth will be vulnerable to attack, whether through trade wars or military invasions, so that there is a cost to local ownership without reliable alliances. "Optimal" country size is thus also about the tradeoff between protecting resources (and such security is positively correlated with size) and the benefit of local ownership free of the need to share with a larger group. I'll concede that risk averse people might agree on a large country size if they did not know whether they would be rich or poor, but once they discover regional wealth, that region can be expected to be exploited, so that the risk aversion argument does not get us very far.
At the same time, large scale and central control creates a monopoly on power that can be destructive. Multi-tiered government can be seen as a kind of compromise. The central government provides security against outsiders, and to a degree manages competition among the member states or regions. (This government comes with agency costs, but the principals have sufficient incentive to defend the resource.) Local governments and their principals are left with enough power to enjoy a disproportionate share of their regional wealth, and they are in the business of competing with one another for mobile citizens, outside investment, and so forth. It is as if the region, or province, buys security and some insurance (because it might be resource poor in the future) in return for some ability to enjoy its wealth and to gain from the competition among jurisdictions within the federation.
If the cost of defense falls, then optimal country size falls. One way for this to occur is through political, religious, or even moral forces that make war less acceptable; another is through international organizations or dominant states with an interest in preserving the status quo, that develop and succeed in reducing international grabs. One can think of international peace-keeping as a yet higher level of government or as a security force for-hire. Either way, these forces or technologies ought to bring about more independence movements and a greater number of sovereign states because of the reduced need to look to a large central government for security.
I am tempted to say that this is where we are in history, and that this helps explain dismemberments (and the increase in the number of sovereign states), except that it is also true that services and human capital have become increasingly important in the creation of wealth. If immobile natural resources are less important than in the past, then we might find less of a drive to smaller states. Smaller states will continue to provide more competition among jurisdictions, and that is good insofar as the market for political power and policies goes, but there will likely be less of a gain in terms of excluding outsiders from making tax or ownership claims on valuable resources. If so, and other things (especially the threat of invasions) constant, we should expect another phase of consolidation. In a roundabout way then, I will be predicting another round of mergers and a reduction in the number of sovereign states.