What?

なに / なん = what (何)
なん = shortened, used before です or before a “counter” like じ (o’clock) or さい (years old). なに before a particle and in なにじん (person of what nationality)

なん ですか = What is it?
これ は なん ですか = What is this?

何の = what kind of, used with nouns. これ は 何の 本 です か = what kind of book is this?

Useful: これ, それ and あれ