Communication makes the world smaller and countries closer, needing more than diplomacy and good foreign relations: they need alliance. Otherwise, a country can lag behind or even be harmed by others. Alliances are more urgent because no international law or body at present properly protects or supports an "individual" state that chooses non-alignment or can't find the right alliance to join.
Today's alliances are tomorrow's countries, as today's countries were yesterday's alliances. A successful alliance is a temporary phase in a country's "life cycle" (that starts and ends with the self-sufficiency of every individual worldwide). Some superpowers consist of neighboring regions that had allied, united and "merged" at some point in history. Others have small space but strong international alliances. Some were facilitated by geography and nature, like most ancient civilizations. Others had to use force and diplomacy, hard and soft powers, to achieve that.
When countries fail to maintain and coexist within an alliance, they seek separation, similar to what some regions do when they seek independence from a country. (Every citizen/region/country hopelessly suffering in an environment has the self-determination right to immigration/independence, if it has better alternatives and owes its mother land nothing.) Choosing the wrong alliance can be equally/more harmful than choosing no alliance, that each country has to carefully study, plan and manage its foreign relations, to benefit most from and "maintain" its alliances. This requires knowledge of one's weakness and strength, and those of others, and ways to benefit other countries too for "mutual" interest.
Alliances can be for a short or long term, with near or faraway countries, for security, economy, technology, culture, etc. Economically, they may have a custom-free trade agreement, high trading/investment/tourism rate, shared lending/funding bank, or shared currency. As for security, they may have shared defense agreement, forces, weaponry, intelligence, etc.
There are large and small alliances according to the number of their member states. A strong alliance can have few but strong members. A strong alliance can also have less strong countries that yet become stronger when united together. Small/weak countries should unite together rather than each faces the world alone or waits forever for strong countries "only" to ally or even cooperate with. In the latter case, such small/weak country must be careful to "fairly" mutually benefit from the alliance/cooperation.
A country can join more than one alliance simultaneously, as long as it follows the rules of each. However, some alliances may prohibit members from joining similar alliances elsewhere.
Alliances vary in strength and purpose. A strong alliance is based on long-lasting mutual interest. Alliances may be founded on shared beliefs, language, culture, economy, security, or borders. However, geography is the most decisive and stable factor in forming an alliance, when properly exploited, leading to all the other factors (that are changeable and temporary), and to full unity and mergence of countries eventually.
Although a country may temporarily lack the knowledge of its own and neighbors' resources, aspects of cooperation, and building "trust" together, still their geographical closeness decreases the cost of shipping/transportation, eases social mobility and cultural understanding, faces common external threats, and shares trade routes, traditions, environment, resources, etc.
This doesn't diminish the importance of cooperation with useful faraway allies, to satisfy a need temporarily lacking locally or regionally. Thus one ends up cooperating almost with every country on Earth, with varying degrees, not just to satisfy a need but also an "ambition."
Colonialism is an extreme one-sided alliance. A colonial/neo-colonial power can prey on a country no one would/could ally with. It may purposely create animosity between it and its neighbors (its legitimate allies) to further isolate and blackmail it. Then according to that power's interest and mood, it may treat it as an ally, proxy, client state, protectorate, or mere colony: a slave country.
The rulers and neighbors of such country are also to blame, for weakening or ignoring it, till it was lost forever to a foreign intruder. A small/poor/isolated state may seek alliance with/support from a distant outsider when it can't find it inside or nearby, at any cost (or damage) for survival. It's an odd alliance of convenience, sacrificing one's identity and sovereignty for security and hopefully a better life.
Colonial powers long competed over colonies, unethically, bloodily, and illegitimately. They haven't changed much, only changing tactics. Hadn't it been for the lack of proper world government or UN for power checking, none of this would have happened. There would've been only healthy relationships between states, like that between individuals: no slavery, usury, blackmail, abuse, rejection, betrayal, etc.
Alliances should grow harmoniously, in a healthy rate, not too fast/slow. A country may quickly join an alliance/superpower it doesn't belong to or can't coexist with. Another may be too slow to join or even lead others when it should, because of fearing competitors, engrossment in home problems, or ignorance about possible allies, and methods and benefits of alliance.
• A small/secondary power needs "specialty & diplomacy" to survive among giant World Superpowers (like any "minority" does). It must seek fast development and join strong alliances with similar balanced interests; else it lags behind and becomes subject to the abuses of others. Once equally/mutually powerful, can it accept full alignment/merging with others—the eventual fate of all world countries. Until then, it derives its limited temporary power from keeping the following balance (a restrictive yet pragmatic strategy) to overcome external threats:
• A cross-road state should carefully choose its alliance, as it has many choices, where it should even choose more than one not conflicting each other. Its inevitable foreign diplomacy shouldn't be at the expense of its security, unity, sovereignty, and basic living necessities. Despite its inherent tension, which is good to an extent, it derives its stability from diplomacy with others, to whom it can be a regional/international "hub"; and from its other soft powers, by being a "model of coexistence" for others. It needs maximum security, preferably from within, or from others, in which case external support must be by trustworthy allies, i.e. ones it's closest to "existentially": geographically, culturally, economically, etc.
• An isolated state is most in need to join an alliance, which is usually easier politically than physically. Not only geographical, but also linguistic, cultural, and economic isolation requires urgent connectivity. Whether a poor resource-less state or a remote island, it must find its niche in world order. Internally, meanwhile, it should protect its national policies (autonomy, economy, culture, etc.) in the sea of globalization, e.g. by banning importing harmful/useless/locally available products. Else, home-made elements get swiped away in the flood of foreign ones.