When to leave is the hardest decision a gambler is facing, for me you need to know your limitation on taking bets like if you lose 50$ then tell yourself thats enough.
Or if you won a few hundred dollars breathe and drink and tell yourself thats enough for today.
The target fixing all depends on individuals because for you $50 may be a small amount but for some people, it may be the big amount so we all should have some targets depends on how much we can afford to lose. The limit should fix for both losses and profit and once we reach any of those limits should stop and come back some other time to try your luck again.