"Where do rights come from?."
Citizenship rights came into being because relatively organized members of the general population bargained with state authorities for several centuries, bargained first over the means of war, then over enforceable claims that would serve their interests outside of war. During the French Revolution, from the Declaration of the Rights of Man onward, bargaining that established citizenship rights took place right out in the open.