Again, engineering is a bit more straightforward than science is. You know you are finished with a project when you have a useful working product that performs the functions you had intended. (Of course, even in engineering, there is frequently the ongoing maintenance work or the need/desire to incorporate improvements.) But science is less clear cut. Yes, there is the work, finish, publish sequence but even after publication of some work there is usually more that remains to be done. I tell my students that you declare a project finished and move on to something else when:
1. Funding runs out on that project
2. Time runs out on that work
3. Your employer puts you on another project
4. You are seeing nothing new
5. You find something else that you could better spend your time on.