When should I replace the brake cable? Here is the picture of the cable from my rear V-brakes:



As you can see it's worn down. Should I replace it now or is it safe to use it for some more time?
Yes, at least one strand has broken. Looks like this happened where the cable was previously under the fastening bolt. Since then, the cable has been let out, maybe to allow for new brake pads?

It would probably last a while before more strands break. But a new cable is only around $5. It's very important to be able to stop your bike reliably, so I would definitely replace it now. It's an easy change to make, cables ends normally slot in fairly easily to the brake levers on V-brakes.