When does client decide to stop/cancel proof of work algorithm?
Now lets say another node guessed it faster than me, how do I know when I should stop my proof of work algorithm?
When do you start trying to guess the next proof of work?

Whenever a node successfully solves a proof-of-work it immediately broadcasts it to the whole network. So whenever you hear a block that you are trying to solve you should stop and start mining a fresh block on top of the newly received block