Westeros is divided into the Seven Kingdoms in Game of Thrones, but why is this the case when there are really nine of them? Given this is where Game of Thrones spends the vast majority of its time, and numerous characters refer to "the Seven Kingdoms", it's surprising that the show never explained this odd little piece of nomenclature.
To find the genesis of the Seven Kingdoms, you have to go back to the time of Aegon's Conquest, which is around 300 years before the events of Game of Thrones. When Aegon Targaryen landed at Blackwater Rush with his sister-wives, Rhaenys and Visenya, it was part of a Westeros that was divided into seven separate realms: The North, ruled by Torrhen Stark; the Mountain & the Vale, run by Ronnel Arryn; Harren Hoare's Kingdom of the Isles and the Rivers; the Rock, which belonged to Loren Lannister; the Reach, ruled over by House Gardener's Mern IX; the Stormlands, overseen by Argilac Durrandon; and finally Dorne, which was then ruled by Princess Meria Martell.
They were the seven lands that Aegon set out to conquer and unite, which he mostly did over the course of the next two years, bringing them together under the rule of House Targaryen and the Iron Throne, as we hear about in Game of Thrones. When Aegon was eventually crowned at the Starry Sept in Oldtown, he was proclaimed 'Lord of the Seven Kingdoms', although even then it wasn't entirely true. The Dornish resisted Aegon's attempts to conquer them by hiding out in the Mountains and engaging in guerilla warfare, and Princess Meria refused to yield.
It wasn't until 187 years after Aegon's Conquest that Dorne officially joined the Seven Kingdoms thanks to a peaceful marriage pact between Prince Maron Martell (the ruler of Dorne at the time) and Princess Daenerys Targaryen (not that one), the younger sister of King Daeron II Targaryen, thus finally making the realm whole. However, this was actually turning the Seven Kingdoms into nine, because Aegon had long since made some big changes to his newfound empire.
The Riverlands, which had long ago been independent, were ruled by House Hoare at the time of Aegon's Conquest. However, as a reward for supporting the Targaryens against the Hoares, the Kingdom of Rivers & Isles was split into two: House Tully was granted lordship over the Riverlands, while House Greyjoy assumed control of the Iron Islands. That made it into Eight Kingdoms, while Aegon also decided to make King's Landing and the surrounding area into a principality of its own, known as the Crownlands, which was loyal solely to the crown. Because of their service during the Conquest, command of the Reach passed to House Tyrell, while House Baratheon was granted the Stormlands. Thus the Seven (or nine) Kingdoms of Game of Thrones were made up as follows:
- The North - House Stark
- The Vale - House Arryn
- The Iron Islands - House Greyjoy
- The Riverlands - House Tully
- The Westerlands - House Lannister
- The Stormlands - House Baratheon
- The Reach - House Tyrell
- The Crownlands - House Targaryen
- Dorne - House Martell
If that looks familiar, it's because it's a status quo that existed until Robert's Rebellion, at which point the Baratheons took the crown, and then further changes were made following Game of Thrones' War of the Five Kings and so on. Depending on how you view it, the Seven Kingdoms as we know them were established with Aegon's conquest, or when Dorne officially joined, and remained so throughout the entire run of Game of Thrones until the finale.
In "The Iron Throne", Sansa demands that the North be granted independence because they will never again bend the knee to someone who rules from the south. That is agreed upon, and so Bran Stark is proclaimed "Lord of the Six Kingdoms" but, in reality, is now the Lord of the Eight Kingdoms in Game of Thrones.