Textbooks claim that the difference between GDP and GNP (or GNI) is about geography vs citizenship--is this correct?
Residency is a complex definition. For example, the Council for Science and Technology of my country supports many graduate students abroad every year. Those guys stay abroad for periods of 1-5 years, yet statistics compilators still count them as residents of the National economy. Why? Because their economic interests are based at home, not the other country.
But there's more to statistics compilation than just that. Typically, the Council for Sci&amp;Tech will provide the statistics office with data on those scholarships. But what do they do with all the folks coming and going in the corporate world? They won't report that, at least not voluntarily. So there are a few rules of thumb that the guys doing the compilation will follow:

Companies working on defined projects abroad are still residents of their home economy.
For instance, a construction company from Mexico building a bridge in Guatemala, a project that will take them 3 years, will be recorded as a resident of the Mexican economy;
Employees working for 1 year or less in another country will still be considered residents of their normal country of residence;
People whose residence moved (declared intention of moving and remaining in the new country) will now be considered residents of their new country.
Companies establishing a branch abroad will be recorded as Direct Investors, and the new branch, a resident of that economy where they are located.

Beware: this may or may not coincide with the definitions by fiscal authorities. This is strictly from a statistics compilation viewpoint. Also, these are rather guidelines, but the more information a statistical office has, the better the compilation. This is why offices of different countries should seek to cooperate with others.