Visas and national identity numbers
In general, all foreign nationals coming to Norway need a visa, although there are many exceptions. The other important offical step you'll need to take is to obtain a national identity number (called a fødselsnummer or personnummer in Norwegian) or a temporary version of this, called a D-number.
Your first step is to determine what kind of visa you need. Students who will be in Norway for more than three months need to apply for a student residence permit while visiting researchers who are here for one year or less need a visiting researcher visa. PhD students and staff will need a work visa, although the type of visa you need depends on if you're from an EU/EEA/EFTA country or elsewhere. The Norwegian Directorate of Immigration (UDI) has a comprehensive website in English.
NATIONAL ID NUMBERS
Both the national ID number and the temporary D-number are 11 digits; the national ID number starts with your birthdate and ends in 5 randomly generated digits. You'll need this number to get paid, to open a bank account and to pay taxes. Skattetatten, the Norwegian Tax Authority, has a good explanation of official requirements, including not surprisingly tax explanations, in English.
You can apply for either a D-number or a national identity number at the Trondheim tax office, but plan for it to take some time to get one. Depending upon the time of year and the tax office's workload, you may have to wait several weeks or more. Because you can't open a bank account without an ID number, newcomers should make certain they have enough cash to cover expenses until they obtain one of these all-important numbers.