Its also genetics and the desire to play.
Grant Hill is not doing it for the money. While I don't know him that well I can guess his time in orlando was not what he had in mind nor dealing with his wifes MS that much "fun". This is a more cerebral player and he has taken care of himself in conjunction with the fine staff in PHX.
Players that see their bodies as investments and do things to protect and inhance that investment along with a genetic gift can play into their late 30s.
Amare may just not have those genetic gifts despite all his efforts and those around him.
It amazed me Shaq was able to play until he was 38. He was not a fitness freak and tended to get big. He did enough and was gentically gifted.