All of the above.
Are they ghosts of humans?
Definitely! We have pokedex entries repeatedly stating that certain species of ghost pokemon were human beings who died. Yamask's notorious entry from Pokemon Black reads, "Each of them carries a mask that used to be its face when it was human. Sometimes they look at it and cry."
All ambiguity as to what Gengar might be (i.e Clefable's shadow) was removed in his 7th generation pokedex entries with the disturbing lines, "It apparently wishes for a traveling companion. Since it was once human itself, it tries to create one by taking the lives of other humans."
Sometimes the souls of the dead appear to possess nature like phantump. These Pokemon are the incarnation of children who died lost in the woods. Frosslass was also described in her Moon entry as "the soul of a woman lost on a snowy mountain possessed an icicle, becoming this Pok?mon. The food it most relishes is the souls of men."
The souls of doomed humans can also become trapped within inanimate objects in the pokemon world, that is how honedge come to be, when the spirits of dead warriors inhabit swords.
Ghosts of other Pokemon?
Possibly. What we for a fact is know that pokemon can die and become ghosts like the Marowak that haunted Pokemon tower. Since ghost type Pokemon have been revealed many times to have been actual ghosts that have come bacm fron the dead, and pokemon can die tragically and become ghosts just like humans in this universe, then pokemon it is plausible that some ghost type Pokemon could be dead Pokemon.
Many ghost Pokemon like Spiritomb are referred to as formed from lost souls, but never identified as human souls over Pokemon. Pokemon Sun says that Sandygast simply "embodies the grudges of the departed." Pokemon can certainly feel grudges, sadness, anger, love. Pokemon database interpreted the restless feelings that form Sandygast as emenating from pokemon, writing that "A Sandygast emerges when the grudges of Pok?mon and other creatures soak into the sand after they fall in battle."
Are they neither dead Pokemon or people?
Yes, while Ghost pokemon are frequently the souls of dead people and perhaps pokemon, there are also pokemon that are exceptions to both. Sometimes objects and organic substances become autonomous without any allusion to them ever being human like the Chandelure line or Banette, a discarded doll that seeks the child that threw it away. Dhelmise is also stated specifically to be the soul of adrift seaweed.
The Pokemon world feels very animistic, where everything in it, people, animals, objects has a life force. In turn I think anything could probably become a ghost Pokemon.
Ghost Pokemon are some of the most fascinating Pokemon out there because they are so varied, and a great deal of what they are is still shrouded in mystery. There are ghost Pokemon such as Marshadow and Sableye that may have never been anything other than their current form, rather than dead beings reinanimated, they seem closer to yokai or demons. They haunt humans, but there is no language in their pokedex entries to indicate that they were previously any other life form. Dusknoir may also be such a Pokemon, a grim reaper figure, but not necessarily dead himself, rather a seperate creature who can be an envoy to the netherworld.