As was mentioned in the other answers, according to the Harry Potter Wiki Necromancy is mentioned by Dumbledore as ineffective:
Albus Dumbledore mentions in his notes on Beedle the Bard that
Necromancy is "a branch of magic that has never worked".
but the Harry Potter wiki is a bit inaccurate in this case.
It's a footnote by JKR's on The Tale of the Three Brothers
which defines necromancy "a branch of magic that has never worked". The full quote is: (emphasis mine in all the quotes here)
"Necromancy is the Dark Art of raising the dead. It is a branch of
magic that has never worked, as this story makes clear. JKR"
While the relevant part of Dumbledore's note on the tale:
"This youngest brother knows that taunting Death — by engaging in
violence, like the first brother, or by meddling in the shadowy art
of necromancy, like the second brother - means pitting oneself
against a wily enemy who cannot lose. "
in the same note Dumbledore on the legend about the Hallows:
"The irony is that a curious legend has grown up around this story,
which precisely contradicts the message of the original. This legend
holds that the gifts Death gives the brothers — an unbeatable wand,
a stone that can bring back the dead, and an Invisibility Cloak that
endures for ever — are genuine objects that exist in the real world.
The legend goes further: if any person becomes the rightful owner
of all three, then he or she will become "master of Death", which has
usually been understood to mean that they will be invulnerable, even
So the second brother, the owner of the resurrection stone was
"meddling in the shadowy art of necromancy" according to Dumbledore.
Likely there is a branch of magic called 'necromancy' in the Harry Potter universe which aim is to raise the dead or even 'master death' that is, to gain immortality. One of the results of such research was the creation of the Resurrection Stone, attributed by some to the Peverell brothers. But even if the Stone was ineffective in bringing back the dead, this probably haven't stopped other wizards to research the subject, tampering with souls and trying to raise and manipulate the dead. The branch or subdivision of magic called 'necromancy' probably continued to exist after the death of the Peverell brothers and was used by different wizards for various purposes over the ages. It's likely that some used it to create undead servants.
So if we speak of necromancy in the broad sense, that is summoning, controlling and raising (un)dead, tampering with souls and dead bodies - there's plenty of such activity mentioned in the books. Besides inferi, zombies and the resurrection stone already mentioned by others there are also
The best examples of necromancy in the books, besides the Resurrection Stone are the Horcruxes, which make the user practically immortal as long as they exist, and the reanimation of Voldemort described in detail in book four, The Goblet of Fire.
Voldemort used fragments of his soul as anchors to keep himself alive, and a ritual involving blood and bones from a human skeleton to (re)construct a corporal body with the original's memories and personality, capable of performing magic. So necromancy definitely works and is effective, judging how much trouble horcruxes caused, even if it proved to be useless in truly mastering death without irreparably damaging the soul.
The consensus in the magic community, even among the 'dark' wizards, seems to be that making horcrurxes is taboo, and probably considered a failed experiment, one that demands too high a price.
Meanwhile, the Hogwarts library had failed Hermione for the first time
in living memory. She was so shocked, she even forgot that she was
annoyed at Harry for his trick with the bezoar. “I haven’t found one
single explanation of what Horcruxes do!” she told him. “Not a single
one! I’ve been right through the restricted section and even in the
most horrible books, where they tell you how to brew the most gruesome
potions — nothing! All I could find was this, in the introduction to
Magick Moste Evile — listen — ‘Of the Horcrux, wickedest of magical
inventions, we shall not speak nor give direction. . . .’ I mean, why
mention it then?” (HBP, CH 18)
But the knowledge was still accessible in Tom Riddle's time. Nothing prevented an ambitious and talented sixteen-year old student with psychopathic tendencies to transform his school diary into a horcrux after he put a bit of effort in it. Horace Slughorn can hardly be described as a dark mage deep in research about cursed artifacts and necromancy, but he is familiar with the term:
“Sir, I wondered what you know about . . . about Horcruxes?”
“No. . . well . . . you’d be hard-pushed to find a book at Hogwarts
that’ll give you details on Horcruxes, Tom, that’s very Dark stuff,
very Dark indeed,” said Slughorn. “But you obviously know all about
them, sir? I mean, a wizard like you — sorry, I mean, if you can’t
tell me, obviously — I just knew if anyone could tell me, you could —
so I just thought I’d ask —” (HBP CH 23)
and also why it shouldn't be used: :
“Well, you split your soul, you see,” said Slughorn, “and hide part of
it in an object outside the body. Then, even if one’s body is attacked
or destroyed, one cannot die, for part of the soul remains earthbound
and undamaged. But of course, existence in such a form** . . .” (HBP,
And Voldemort himself describes the experience less than enjoyable:
“I was ripped from my body, I was less than spirit, less than the
meanest ghost . . . but still, I was alive. What I was, even I do not know . . . I, who have gone further than anybody along the path that leads to immortality. You know my goal — to conquer death.” (GoF CH 33)
Slughorn says it's natural an intelligent wizard would be interested about the subject:
“Not at all, not at all, not offended,” said Slughorn gruffly. “It’s
natural to feel some curiosity about these things. . . . Wizards of a
certain caliber have always been drawn to that aspect of magic. . . .”
(HBP CH 23)
but even if it was considered a failed experiment and taboo in Horace's time, it was still a magical invention, part of the knowledge on necromancy and it was preserved. Hogwarts is not the only place magical research is studied and made. There's a chance than other schools, for example Durmstrang, (a school famous for teaching the dark arts) have more materials on the subject with detailed explanations why it is not advisable to use horcruxes along with additional research in other directions in necromancy, maybe less amoral than the horcruxes.
Dumbledore himself aspired to become the conqueror of death and was reserching the Hallows, including the Resurrection Stone, thus engaging in what he calls 'the shadowy art of necromancy'.
Nearly Headless Nick describing how he became a ghost:
I was afraid of death", said Nick softly. "I chose to remain behind." (Order of the Phoenix)
There are no details whether this 'choice' requires magic (necromancy) or it is also presented to any muggle / squib.
But there is indication that there are spells that can affect ghosts. Fleur Delacor seems to think that the Beauxbtons staff has the means to get rid of an unwanted poltergeist:
“At ze Palace of Beauxbatons, ... We ’ave none of zis ugly armor in ze ’alls, and eef a poltergeist ever entaired into Beauxbatons, ’e would be expelled like zat.” She slapped her hand onto the table impatiently. (OotP, CH 23)
It may be just Fleur's opinion, and getting rid of a regular ghost or a poltergeist may not be that easy, but in the same book later Myrtle complains to Harry that the ministry ordered her to stop haunting her former classmate and return to Hogwarts:
“— and then, of course, she went to the Ministry of Magic to stop me stalking her, so I had to come back here and live in my toilet.” (OotP, CH 25)
It indicates that the wizards of the Ministry of Magic have some way of controlling ghosts.
On the other hand, a bit surprisingly, ghosts in the HP universe are not immune to pertification, they are affected by air- and waterstreams (Myrtle can be flushed down the toilet into the lake, pertified Nick can be propelled in the desired direction) so it is unclear whether it is necromancy that is used to create or control ghosts or something else.