In the Harry Potter movies, we have seen ghosts hanging around in Hogwarts, like Nearly Headless Nick, Moaning Mrytle and so on. But when Cedric Diggory or Sirius Black died, they never came back as ghosts? Nor Harry's parents. Why can some people turn into ghosts after death and still be able to 'live' and some can't? It would be a good thing for Harry if his parents could become ghosts, wouldn't it?
They could, but they chose not to.
This is answered in the books on which the movies are based. After Sirius's death, Harry asks Nearly Headless Nick, the ghost he knows best, whether there's any possibility of his godfather coming back as a ghost:
"Wizards can leave an imprint of themselves upon the earth, to walk palely where their living selves once trod," said Nick miserably. "But very few wizards choose that path."
"Why not?" said Harry. "Anyway - it doesn't matter - Sirius won't care if it's unusual, he'll come back, I know he will!"
And so strong was his belief, Harry actually turned his head to check the door, sure, for a split second, that he was going to see Sirius, pearly-white and transparent but beaming, walking through it towards him.
"He will not come back," repeated Nick. "He will have ... gone on."
"What d'you mean, 'gone on'?" said Harry quickly. "Gone on where? Listen - what happens when you die, anyway? Where do you go? Why doesn't everyone come back? Why isn't this place full of ghosts? Why -?"
"I cannot answer," said Nick.
"You're dead, aren't you?" said Harry exasperatedly. "Who can answer better than you?"
"I was afraid of death," said Nick softly. "I chose to remain behind. I sometimes wonder whether I oughtn't to have ... well, that is neither here nor there ... in fact, I am neither here nor there ..." He gave a small sad chuckle. "I know nothing of the secrets of death, Harry, for I chose my feeble imitation of life instead. I believe learned wizards study the matter in the Department of Mysteries -"
-- HP and the Order of the Phoenix, Chapter 38: The Second War Begins
Sirius, like Cedric and Harry's parents, was far too adventurous to take the coward's path and choose that "feeble imitation of life" rather than continuing on into the great unknown.
JK Rowling also addressed this directly in an interview in 2004 (emphasis mine):
If Harry had a portrait of his parents it would not help him a great deal. If he could meet them as ghosts, that would be a much more meaningful interaction, but as Nick explained at the end of Phoenix—I am straying into dangerous territory, but I think you probably know what he explained—there are some people who would not come back as ghosts because they are unafraid, or less afraid, of death.
That last bold quote sums it all up really.
(This answer is partly inspired by @alexwlchan's excellent answer to the same question on another Stack Exchange.)