Just a question in general. Let's say the protagonist has succeed in his goals, but has lost everything, then he gets badly wounded and slowly dies. What is to avoid when writing his death? Just asking in general.
The death of the protagonist and the events surrounding it should further the plot or character development
If giving him a slow death in no way furthers the plot or someone's character development, then please kill him quickly.
There are a whole lot of unanswered questions here which would influence how much writing you want to put into Mr. P's death.
Do the readers have any sympathy for Mr. P?
If there is a lot of interest in Mr. P., then his death can be expanded. You can use it to delve into why he made the choices he made or didn't make.
How did he lose everything and does that make him a more complete character? Is it important to the story (or to the theme) that he lost everything?
Maybe you want to leave an air of mystery around his death. Did he or didn't he? Might he come back in the sequel?
I guess what I am saying, to answer your question, is to make his death meaningful. Avoid any other claptrap that does nothing but fill the pages.
I'd suggest a secondary protagonist that "carries the torch" when the protagonist dies. Even when done well, there's a marketability issue if the one character everyone cares about bites it.
Also, there's a great deal of respect for self-sacrifice. Dying for a cause is a successful and uplifting way to accomplish your task.
The first two blockbuster movies coming to mind are Terminator 2 and Armageddon.
However, there was this American movie from the '70s called Ordinary People which won "Best Picture" Academy Award, but nobody tried to replicate because it was so depressing--the MC commits suicide at the end.