Write spanish with a lowercase s in an essay and you have made a spelling error, however good the rest of the sentence is. Spanish and French speakers do it constantly, because in their own languages nationalities and languages are lowercase. In English they are always capitalised: a Greek salad, she speaks French, the Brazilian team. It is the easiest fix on the page, so check it when you proofread.
The endings
Most nationality words finish in one of a handful of ways, but the groups are loose and the exceptions are real.
The largest group is -an / -ian: Italian, Canadian, Brazilian, German, Korean, Egyptian, Peruvian. When you have no idea, this is the safest guess. Norwegian is the one that catches people, because it does not come from Norway plus a suffix, so learn it as it is. Argentina is a small oddity too: both Argentine and Argentinian are used.
-ish covers Spanish, Polish, Turkish, Swedish, Danish, Finnish and Irish, among others. -ese gives Chinese, Japanese, Portuguese and Vietnamese, and these never take a plural -s: two Japanese students, not "two Japaneses". -i turns up mostly for countries in the Middle East and South Asia: Iraqi, Kuwaiti, Pakistani, Yemeni, Israeli.
Then there are the words that go their own way. Dutch for the Netherlands, Swiss for Switzerland, Greek for Greece, Cypriot for Cyprus. Some of these still look like their country (Greece, Greek), others do not (the Netherlands, Dutch), and no single rule covers them. Treat them as individual items to memorise.
One person, many people
This is where a lot of upper-intermediate writing goes wrong.
With -an and -i words, the same form works as an adjective and as a noun for one person: He is Italian and He is an Italian are both fine, and so are a Pakistani and a Canadian. They also take a normal plural: Germans, Canadians, Iraqis.
With -ish and -ese words the adjective usually cannot stand alone as a singular noun. "I met a Spanish yesterday" is wrong, because Spanish here needs something to describe. You have three ways out. Add a noun: a Spanish woman, a Japanese student. Use the separate word where one exists: Spaniard, Pole, Dane, Finn, Swede, Turk. Or, for English, French and Irish, use the -man / -woman forms: Englishman, Frenchwoman, Irishman.
If you cannot remember the noun, a Spanish person is perfectly acceptable. A plain correct phrase is better than an elegant wrong one.
Words that do not change in the plural, such as Swiss, Chinese and Japanese, work the same way in both numbers: one Swiss banker, three Swiss bankers.
Talking about a whole nation
For everyone in a country, put the in front of the adjective: the Swedish, the Dutch, the Portuguese. That is a general statement about a population, so it is best kept for broad claims. For something more neutral, add people: Swedish people, Portuguese people. Where the noun has a regular plural you can also use it without the: Germans, Italians, Canadians.
Britain, England and the rest
This confuses learners and native speakers alike, so it is worth separating.
British refers to the United Kingdom as a whole. English, Scottish and Welsh refer to the individual countries, and a Scottish person will not thank you for calling them English. For a single person from the UK, a British person is the safe and formal choice. A Briton exists but sounds fairly formal, and it appears mostly in newspapers. For Scotland you will see Scottish, Scots and Scotsman, and for Wales a Welshman or a Welsh woman.
Where this appears in exam preparation
Nationality words are not a topic anyone is tested on by name, as far as I know. They show up in your own writing, where spelling and word choice are assessed along with everything else, and possibly in word formation tasks where the base word happens to be a country. I have no figures on how often that happens, so take it as a reason to know them, not a prediction.
The informal ones
Once you know Brit and Aussie, they tend to appear in writing. They are real nouns that British and Australian speakers use all the time, but they are informal, and a formal letter, report or essay does not want them. Keep British person and Australian for the exam, and save the short forms for conversation.
What to do with all this
Pick the five countries you are most likely to write about, such as your own, the UK, the US and two others. For each one, write the adjective, the noun for one person and the form you would use for the whole nation. Check them in a dictionary and keep the ones you got wrong.