In order to own a sector, you must have at least one of the following present in the sector:
- a land unit
- non-captured civilians
If at any time you do not have at least one of those 3 things in a sector, you will lose control of it. If you are not the old owner at the time you lose the sector, it will revert to the old owner. Otherwise it will revert to the deity, country #0, even if another country's land units are present in the sector. If there are no people at all in the sector, it will revert to the deity.
Note that this means that if you attack a sector and do not move in, you will not gain possession of it. If there are civilians in the sector, the sector will revert back to the original owner. If there are no civilians in the sector (and no mil or units, because you just killed them), the sector will revert back to the deity.
Similarly, if you abandon a sector, it'll revert immediately.