- "Thus the Starks took it upon themselves to unify the North... under them. They drove the pirates out of White Knife, and claimed the eastern coast. And married the Marsh King's daughter for the Neck. A Stark wrestled for Bear Island and won. Or so they say... Silly stories all. Blood and steel won the North... and the Starks had the most of both."
- ―Roose Bolton
The Unification of the North was a process that traditionally lasted for two milennias, in which House Stark gradually repelled Ironborn invaders and subdued Northern rivals, particularly House Bolton. The countless wars saw the birth of the Kingdom of the North, which would last until the War of Conquest more than 6,000 years later.
Following the Stark victory against the Barrow Kings in the Thousand Years War, The North was divided between several petty kingdoms. The Winter Kings of Winterfell and the Red Kings of the Dreadfort were the most powerful of them all, and their rivalry resulted in countless wars over a period of several centuries. These wars were decidedly indecisive, and the Boltons killed several Starks in this period. The Boltons also earned themselves a sinister reputation for flaying their enemies, a practice that eventually made itself to their sigil, which displays a flayed man hanging upside down from a cross.
Internal Northern wars had the effect of opening the North for pirates and raiders as well. King Jon Stark drove Sistermen pirates from the White Knife, and his son Rickard Stark defeated the last Marsh King and brought The Neck into the fold.
Not all parts of the North were brought under Stark dominion by military means. House Manderly, an exiled house from The Reach, was given land by the White Knife in exchange for loyalty. King Rodrik Stark won Bear Island from the Ironborn in an arm wrestling match with a leader of House Hoare; the Island was subsequently gifted to House Mormont. The fealty of House Umber was won by helping them fight off wildling raiders. House Karstark came to be when Karlon Stark was given Karhold in return for putting down a rebellion.
Due to their inferior numbers vis-a-vis the Starks, the Boltons were eventually defeated. The last Red King Rogar Bolton bent the knee to House Stark, who later banned their gruesome practices. This marked the birth of the Kingdom of the North.
The Boltons bent the knee just in time for the North to face the Andal Invasion united. The Starks, the Boltons and other Northern houses faced Andal invaders at Moat Cailin countless times, until the Andals eventually gave up their attempts to conquer the North. This joint effort did not result on harmony between the Northern houses; the Boltons rebelled against Stark rule several times, though the Starks put down every revolt.
The bad blood between the Starks and the Boltons persists 6,000 years later. The Boltons were one of the orchestrators behind the Red Wedding, which saw the fall of the newly-reborn Kingdom of the North and the death of King Robb Stark. The Boltons were defeated for good in the subsequent Battle of the Bastards, in which the remainder of the Stark family retook Winterfell and killed Ramsay Bolton, the last Bolton alive.
In the booksThe unification of the North began soon after the Long Night 8,000 years ago and ended just as the Andal Invasion was beginning 6,000 years ago. Though the Boltons were the last House to submit, just as the first Andals were landing on the eastern coasts, it still took thousands of years after that for the Starks to solidify their hold over all of the North.
The Season 6 Histories & Lore video on "Northern Allegiances to House Stark" claims that the Starks used to be vassals of the Barrow Kings, but they later led the North in a revolt against them because they didn't defend them during the Long Night when the Starks did. Actually, the exact words of the World of Ice and Fire sourcebook (2014) simply say that the Barrow Kings claimed overlordship over all the First Men (due to their descend from the First King)...but doesn't confirm if they ever functionally held such a position, or if it was just an empty boast. The Starks have never been described as "vassals" of the Barrow Kings in such specific terms - though overall descriptions of this time period are brief and vague.
Some of the Starks' vassals in the present day used to be petty local kings, just like the Starks. They were either forced into submission or joined the Starks willingly (through marriage-aliance, etc.) to unite against common threats. These included: House Bolton, House Glover, House Locke, and House Dustin (who descend from the defeated Barrow Kings). "House Flint of Breakstone Hill" also used to be petty kings - this may refer to the "First Flints" of the mountain clans. House Locke hasn't appeared prominently in the TV series: their lands are southeast of White Harbor.
There were several other petty kings who refused to surrender and thus were totally destroyed. One of the more notable among these was the Warg King at Sea Dragon Point. The Greenwoods, Ambers, Towers, and Frosts were also local kings in the ancient past, but nothing is remembered of them other than their names.
Other Northern vassals are confirmed to have never been kings, but were given their lands by the Starks. House Mormont was given Bear Island after the Starks took it back from the ironborn. House Manderly was awarded land to build White Harbor after being exiled from the Reach. House Karstark was a cadet branch of House Stark itself, given lands after putting down a rebellion (probably by the neighboring Boltons). House Reed actually doesn't descent from the last Marsh King - they were a separate family of the crannogmen that were raised up to rule the rest after King Rickard Stark killed the last Marsh King and took his remaining daughter to wife.
The status of the remaining major Houses during this unification period is unclear, whether they used to be petty kings or are vassals the Starks rewarded with lands later. These include House Cerwyn, House Hornwood, House Tallhart, and House Ryswell - of which only the Cerwyns and Hornwoods have prominently appeared in the TV series. The Ryswells currently rule the Rills, and it is mentioned that in ancient times there was a "House Ryder" of the Rills, so they may have been petty kings the Starks wiped out and replaced with the Ryswells. There at also apparently two branches of "House Flint": House Flint of Widow's watch in the southeast, and House Flint of Flint's Finger on Cape Kraken west of the Neck. Both of these are actually cadet branches of the "First Flints", a relatively minor mountain clan northwest of Winterfell - if the First Flints do indeed descend from "House Flint of Breakstone Hill", their cadet branches could also claim a distant ancestry of petty kings.
Otherwise, except for the Boltons, all of the current Northern Houses are fiercely loyal to the Starks, as they have led their defense since the Andal Invasion.
After the North itself was unified, it still faced attacks from without. They were defended by the Wall to the north and impassable Moat Cailin to the south, yet the Starks continued to fight off invasions on both coasts. To the west, the ironborn often frequently captured Bear Island, Cape Kraken, the Stony Shore, and Sea Dragon Point - lands which traded hands back and forth between the Northmen and ironborn multiple times. To the east, they faced attacks by pirates and slavers from the Free Cities targeted at the mouth of the White Knife River, the main waterway of the North (which relied on it more than roads, as the Kingsroad hadn't been built yet). Worse, to the east the North often warred with the Vale of Arryn over the Three Sisters islands, and when the fighting went against them the Vale would attack the mouth of the White Knife as well.
House Manderly only moved to the North about 1,000 years ago, after being exiled from the Reach. The Manderlys then built White Harbor at the mouth of the White Knife, the North's only true city. They soon became the wealthiest family in the North and staunch defenders of the eastern coasts. Thus the Manderlys were themselves Andals, and didn't fight against the actual Andal Invasions at all. The Season 6 Histories & Lore featurette "Northern Allegiances to House Stark" contains an inaccurate line that the Manderlys helped fight off the Andal attacks: this contradicts information given in other videos, and was apparently referring to the much later attacks from the Vale.