The bad guy gets away because they don’t have enough evidence.
People confess when there is hardly any evidence (a lot).
The detectives realize they were wrong.
Lots of things happen.
Detectives being wrong isn’t a very dramatic like you might think. Many operate like scientist, gathering data, testing their theory along the way and adjusting.
One of the most interesting episodes was when they investigated a murder of a local girl in a park. Whole department assigned to work it because her ex and the main suspect was a guy who was a local criminal who had done time for murder before and was suspected in other cases.
Lots of misc evidence pointed at bad guy, but not enough to prosecute him, just lots of elements that pointed to him. Bad guy was smart enough not to talk to the police when they brought him in.
Near the end they got back some cell phone location info ... in the park that night wasn't the bad guy... but her current boyfriend (the local good college boy) phone was there. He claimed he was elsewhere / hadn't seen her that night...
Good boy confessed when they confronted him.
That episode was wild.