The quick answer is either "When you've reached the end of the program" or "When you're not longer progressing or your goals change".
I don't know anything about the program you're following, so I'm going to address two different types of programs and introduce a concept by Dan John, bus bench and park bench programs.
The two different types of programs are likened to, as you may guess by the names, park benches and bus benches. When you sit on a park bench, you're probably just taking in nature, relaxing, looking around and taking your time. You have no set schedule, if Skippy the squirrel comes along to say hi, great, if he doesn't, then tomorrow is another day. When you sit on a bus bench, you're (usually) waiting for a bus, you expect it to arrive at a set time and take you where you want to go. It's a much more structured thing.
A bus bench program is one where you have a definite goal in mind. Drop 10 lbs, prep for a lifting meet, step on stage oiled up in your underwear (otherwise known as a bodybuilding contest). These are the programs that are tough, designed to be run for a limited period and are, unfortunately, what most people think of when they talk about training. They're programs like the Smolov Squat program or Ed Coan's Deadlift Routine.
To quote Alice in Wonderland
“Begin at the beginning," the King said, very gravely, "and go on till you come to the end: then stop.”
When you reach the end of one of these programs, stop and change to something else (a park bench program).
A park bench program would be something that you do for a longer, indeterminate period. It's something that allows you to gradually improve without burning you out at all. It's the un-sexy, reasonable program that trainers couldn't charge £29.99 for because it's not deemed tough or extreme enough. Something like Dan John's Easy Strength program, Jim Wendler's 5/3/1, Starting Strength or StrongLifts 5x5.
These programs are never really "finished", they could potentially go on forever, or until you hit a plateau (most do include a way to break plateaus, though they're not always successful). If your lifts haven't gone up for a while, you're not adding reps and you can't seem to get past it, then it might be time to look at other options.
Several authors recommend taking a couple of periods a year to test yourself, be it a competition, stepping on stage or doing a more balls to the wall, short term program (a bus bench program).
Another reason might be simply that your goals have changed. Starting Strength, while a good program, does tend to lack (from memory) any form of conditioning work or direct arm work, so if you wake up one day and realise you're pretty strong, but don't look that good at the beach, your goal may change to that of a more aesthetic one from a strength one.
There are also the changes by necessity (injury, new arrival in the family, new job, etc), but hopefully most people are smart enough to realise those by themselves.