Throughout the Harry Potter series, we see that deceased Headmasters of the school get a semi-sentient portrait of themselves in the Headmaster's Office, at the service of the current Headmaster. Do all Headmasters get a portrait? What are the conditions of getting one? For instance, there are a couple of times when Dumbledore is temporarily deposed as Headmaster: Dolores Umbridge takes over the job in Order of the Phoenix, and Minerva McGonagall takes the job in Chamber of Secrets and Half Blood Prince. Will Umbridge and McGonagall have portraits in the Headmaster's Office when they expire?
From a press conference with JKR, here:
Q: Is Severus Snape's portrait in the headmaster's office?
JKR: Some have been asking why hasn't the portrait appeared immediately. It doesn't. The reason is that the perception in the castle itself and everyone who was in the castle, because Snape kept his secret so well was that he abandoned his post. So all the portraits you see in the headmaster's study are all headmasters and mistresses who died, it's like British royals. You only get good press if you die in office. Abdication is not acceptable, particularly if you marry and American. I'm kidding! [laughter] I digress...."
Umbridge did not die in office, and like Snape the 'perception in the castle itself' implies that you need to be in good standing to get a portrait immediately, Harry is known to have made sure Snape got a portrait next to Dumbledor.
I know Harry would have insisted that Snape's portrait was on that wall, right beside Dumbledore's.
So, Did all Headmasters get a portrait in Hogwarts? Only if they died in office, in good standing. I don't think a headmaster (voluntarily) retiring is ever covered in or out of the books, and I'd imagine it was unlikely they would get a portrait.