It probably started as groups of people trying to survive bandits in a village, then in a castle, then a city state and then on some land. Before you know, there's a different culture.
If you claim sovereignty over a state's territory, violate its laws, refuse to pay its taxes, and threaten its citizens will violence, will the state respond?
If their response is severe enough to bring you into line, the state exists. If not, then the state is fiction.
Just a lot of people believe in the same fiction and hence it appear real because of reinforcement learning.
Some take the fiction too seriously and get a pride from believing in the great fiction they live. Some push it extreme and die for the fiction.