There is no one-size-fits-all answer to this question—as the extensive discussion in comments illustrates.
However, I can address the points you raise one by one and explain how they do or don't factor into whether this is an acceptable or advisable course of action.
- It was poorly written (e.g. language, formatting, missing assumptions).
Doesn't matter much by itself. If the question was understandable and was understood, or if it was ignored because of the bad formatting but you understood it just fine, you should edit it. And perhaps comment on it as well.
If your question is inspired by it but is substantially different or far more complete a question, then of course just ask your new and different question, and link to the original one.
- It was posted many day ago but got only a few views.
A few days is not a very long time. It's certainly not enough to consider the post has been abandoned.
If a question was posted two years ago and seems unclear, abandoned, already been discussed, then of course go ahead and post a new question.
You can also check the "last seen" time on the asker's profile, to see if he/she is still around.
- It received some comments which admonish to clarify the question. Even some close-votes for "unclear what you are asking". The OP seems to have lost interest in the question at all or does at least not change any significant part. However, once understood, it is actually an interesting and non-trivial problem.
If the question is only a few days old, edit to salvage, even if it's a huge rewrite that only preserves the nugget of the question and all the wording is different. If it's not your question and you only came upon this very interesting and non-trivial problem because of the original asker, then he/she deserves some credit even if in need of some linguistic assistance.
- It received some answers, but neither solved it completely but just gave some ideas and observations, or was itself poorly written so that most readers will not understand the problem better after reading it. Also no answer was accepted.
This may also be a case where a bounty could be appropriate. And, on this site which has such an active chatroom, it could also be a good idea to bring it up in chat (after editing the question so it's worth reading and is clear).
Everything under the assumption that editing the older question to make it fit the requirements for a "good question" is out of scope without maybe going over the top of what the OP could have done/understood. In the end, I am earning the upvotes for my effort to phrase/format it nicely. Or is it like stealing the question because we mainly upvote for interesting problems?
This is the crux of the question. It's almost entirely a judgment call. My main criterion would be the age of the question, with its unclarity a close second.
I personally think that, providing the user asked in good faith and wasn't rudely rejecting any requests for clarification (which could get ugly in other ways), you should acknowledge and upvote the interesting problem and edit it so it's clear.
You won't earn upvotes, but you might earn the Strunk & White badge or even Copy Editor. ;) If it's old (6 months+), there are other badges you can earn. And if you edit and answer it, and your answer is good, there are still other badges you can earn.
In short, don't worry too much about the upvotes on this question. If you conduct yourself in the way that is best for the site, you will likely come out ahead.
(This isn't always the case that "altruism pays," but in this case it is the certainly the correct way to judge the situation.)