Your residency is where you live, officially. A residency is also a temporary professional visit, like when a doctor does a residency at a hospital or a poet does a residency at a school.
When someone emigrates to another country, they don't just visit temporarily — they gain residency in the new country, becoming a legal resident. And if you get a driver's license, you'll get it in the state where you have residency. Another way to use this noun is to mean "a stage of medical training." After attending medical school, new doctors have a residency at a hospital, where they specialize in a particular branch of medicine.