Have any countries peacefully merged into one country? I am particularly interested if a modern example exists.
You may have heard of the "heptarchy" of seven Anglo-Saxon kingdoms. Actually there were about a dozen Anglo-Saxon kingdoms in the year 600, and about five of them were important in Anglo-Saxon history. Some historians have suggested that there might have been hundreds of tiny Anglo-Saxon kingdoms in the 6th century, which merged peacefully or violently to form the 12 kingdoms existing by 600.
Over centuries the 12 Anglo-Saxon kingdoms gradually merged until in 927 the Kingdom of England was formed, ruled by the dynasty of the former kingdom of Wessex.
The Kingdom of Scotland formed out of several British, Anglo-Saxon, Pictish, Irish, and Norse kingdoms,having an official formation date of 843, though the borders between Scotland and England varied for several centuries. The union of various kingdoms was partially violent and partially peaceful, and mostly the methods were not recorded by history.
King James VI of Scotland became King James I of England and Ireland in 1603 in a personal union. In 1707 Queen Anne of England, Scotland and Ireland became Queen Anne of Great Britain and Ireland due to the Act of Union. Due to another Act of Union, King George III went to bed on Dec. 31, 1800 as king of Great Britain and Ireland and woke up on January 1, 1801 as king of the United Kingdom of Great Britain and Ireland.
Princess Isabella of Castile, etc. married Prince Ferdinand of Aragon, etc., in 1469. Isabella became Queen of Castile, etc. in 1474, and Ferdinand became king of Aragon, etc. in 1479. Their daughter Juana la Loca became Queen of Castile, etc., in 1504 when isabella died, and Queen of Aragon, etc. in 1516 when Ferdinand died, with her son and co king Emperor Charles V ruling in her name. In 1715 King Philip V decreed that the Spanish kingdoms were united into one single kingdom.
In 933 Hugh of Arles, king of Burgundy, and Rudolph II, King of the other Burgundy, were rivals for the crown of italy.. Son in 933 they made an agreement were Rudolph II gave up his ambitions in Italy and Hugh gave him his kingdom of Burgundy. Thus the two kingdoms of Burgundy merged in 933 to form the kingdom of Arles or burgundy. King Rudolph III of Burgundy (ruled 993-1032) was forced to agree that Emperor Henry II (r. 1002-1024) would be his heir, and then had to make Emperor Conrad II (r. 1024-1039) his heir. So in 1032 the position of King of Burgundy was merged with the position of emperor.
Vermont was an independent republic from 1777 to 1791 and became a state in the USA in 1791. The Republic of Texas from 1836 to 1846 eventually asked to join the Union and was admitted as a state in 1846. Americans in California proclaimed a California Republic in 1846 which lasted for 25 days before becoming administered by the USA. Americans in the Kingdom of Hawaii overthrew the government and formed the Republic of Hawaii (1894-1898) which asked to be admitted to the Union. Hawaii was annexed as a territory in 1898 and became a state in 1959.
These are some examples I could think of independent states merging more or less peacefully and voluntarily.
Added 01-22-2020. Wikipedia has an article "Boer Republics" that lists 18 states founded by Boers or Afrikaners between 1795 and 1887 which had little diplomatic recognition. The Orange Free State (1854-1902) and the South African Republic or Transvaal (1852-1877, 1881-1902) were the famous and long lasting ones, but were conquered by the British in the Second Boer War. The others were very short lived, and had various fates.
The Lyndenburg Republic (1849-1860) and the Utrecht Republic (1852-1858) joined the South African Republic. The State of Goshen (1882-1883) and the Republic of Stellaland (1882-1883) united in 1883 to form the United states of Stellaland (1883-1885), The Transvaal tried to annex the United States of Stellaland but the British eventually annexed Stellaland.
The gradual merger of Germany into a single country is an example. This took a long time, starting with the absorption of many smaller countries by Prussia, and the formation of customs unions. A major step was the formation of the German Empire in 1871, which created political and administrative integration, and put an end to wars between the German states.
After WWII, new states were set up, one of the priorities being to abolish the dominant state of Prussia, and those remain, with some adjustments, the basic governmental units of Germany, somewhat similar to states in the USA.
When Germany was partitioned after WWII, it was done along state boundaries. While the two parts of Germany functioned as separate countries until re-unification in 1990, they always regarded themselves as parts of what should be a single country (although they didn't agree about how it should be governed).