The constitutions of 23 countries specify how territories may secede, according to Constitute. Here is the clause from the Liechtenstein constitution:
Individual communes have the right to secede from the State. A decision to initiate the secession procedure shall be taken by a majority of the citizens residing there who are entitled to vote. Secession shall be regulated by a law or, as the case may be, a treaty. In the latter event, a second ballot shall be held in the commune after the negotiations have been completed.