Should I stay or should I quit?
Check out sunk cost. Although this might seem completely counterintuitive, the investment you have made should be irrelevant to your decision to stay or quit, if this investment has already been made and cannot be recovered.

What matters is whether the benefits you are yet to incur outweigh the costs (that you are yet to incur). So the decision should be a forward-looking one.

The above reference mentions that in the real-world, people often do not behave in this way. According to sunk cost theory, this is irrational, but this is only one theory.