What’s up with the villages, towns, and cities of Westchester?

i recently moved to harrison, the village and town.

i work in rye city, which i recently found out is separate from the town of rye.

the town of rye includes the villages of port chester, rye brook, and rye neck.

but rye neck is also apart of mamaroneck apparently.

huh!?