This question already has an answer here:
I remember that once Nearly Headless Nick told Harry that souls find a chance to come back to the world or go the other way (or something like this). Those who choose to come back or have an unfinished business come back. For example, Moaning Mertyl came back as a ghost to haunt those who bullied her.
Many people in the Wizarding World has some unfinished business. They can come to fulfill those. Death Eaters like Bellatrix could come to get revenge. So why isn't the Wizarding World filled with ghosts?