Anyone who takes a look at the Seerah, and at the Stories of the Prophets in the Quran would notice a trait and a secret to their successes; they didn't quit when it made sense for them to quit. And the one Prophet that left his people angrily, Yunus (Peace be upon him), was reprimanded by Allah and was asked to go back to his people and they believed.
Despair, quitting, is losing hope in Allah's mercy, not just in the hereafter but in worldly matters as well, and as Muslims we shouldn't lose hope in Allah's mercy in whatever we do. If we're working on a project, if we're completing our researches, when we reach a point where we think it makes sense to quit, that's when we should proceed.
I have a little lifehack for you when you reach such a stage; go make wudu and pray 2 rak'a to Allah asking him for his help, and see how Allah opens things for you.
Finally, I leave you with this beautiful poem, called Don't Quit:
When things go wrong, as they sometimes will,
When the road you're trudging seems all up the hill,
When the funds are low, and the debts are high,
And you want to smile, but you have to sigh,
When care is pressing you down a bit,
Rest if you must, but don't you quit.
Life is queer with its twists and turns,
As everyone of us sometimes learns,
And many a failure turns about,
When he might have won had he stuck it out;
Don't give up though the pace seems slow,
You may succeed with another blow.
Success is failure turned inside out,
The silver tint of the clouds of doubt,
And you never can tell how close you are,
it may be near when it seems so far;
So stick to the fight when you're hardest hit,
it's when things seem worse,
that you must not quit.