Permanent variables, with no prefixes, or prefixes of $,# and ## never reset unless you null them by yourself, that includes string variables ($ postfix).
There's no real difference between just variable and arrays, as normal variables are treated as array with index[0]. You can check that out yourself, for example TestVar and TestVar[0] will yeild same result if you set only one of them.
Temporary character variables are reset when character logs out. Temporary server variables ($@ prefix) reset during map server reset. Until that they're stored safely. NPC variables (. prefix) are also reset during server reset. Most interesting are scope variables (.@ prefix). They are reset whenever script hits an end (that includes close). They are very useful as a temporary variables you can use to count something, like if you need to rand a number and use it in 2 different parts of code, or for looping.
Also, Hercules has instance variables (' prefix), I believe those are nulled out once instance is destroyed, but can't be sure.
And some interesting fact about NPC variables: they are shared between duplicates of one NPC. I once hit that wall quite hard trying to figure out why it didn't go as planned at first with duplicate NPCs (And I'm quite lazy so I try to do almost everything with duplicates if it's possible. Using names of NPCs to store needed info to be able to duplicate easily is fun
)