How can a court rule that someone could be dangerous?
By looking at their past behavior. A sadistic murder of teenagers would get you on the "could be dangerous" list rather quick.
This sort of thing is actually rather common. Whether the defendant is likely to continue a life of crime is a common aggrevating circumstance which, quite reasonably, often lead a judge to impose (or a jury to recommend) a heavier sentence, just like the criminals' claim of being reformed is often a mitigating circumstance leading to a lighter sentence.
As to your question, how do we know the defendant is more (or less) likely to commit a future crime? Well, the same way we know whether anybody else is more (or less) likely to do anything in the future: we look at their past and present behavior.
Showing public remorse, cooperating fully with the police, and other things of that nature are evidence one is less likely to repeat the crime; not showing remorse, never apologizing and so on--and, sometimes, the very horror of the crime--is evidence that the criminal is likely to do it again.
I'm not talking about the crime for which she was convicted and for which she has paid for.
The idea that the criminal, once having served one's sentence, had "paid their debt to society" and therefore should not be treated any differently than someone who did not commit a crime in the first place is a case of a metaphor being taken too far.
Criminals do not pay their debt to society by their prison sentence: crime and evil are not a matter of double-entry bookkeeping. A vicious murderer is quite justly shunned and hated because he is a vicious murderer; whether or not he served any time in jail for it is immaterial, and is no reason to hate him less.
The mere fact that one was caught and punished does not raise one's moral status one iota, nor does it give one the slightest reason to expect better treatment than the unpunished murderer from society.
If it is at all possible to "pay one's debt to society" for such a vicious murder, then such payment must be done by changing one's essence--but not being the vicious murderer any more. That must include, first of all, genuine and public remorse; the deliberate and willing seeking of punishment for the crime (a la Raskolnikov in crime and punishment); the offer of restitution and good works to the victims or society; and so on.
If one had done all that, then it might be possible to "pay one's debt" to society and become on morally equal terms with it again, although one can argue that for crimes as horrific as Karla's, it is simply humanely impossibly for any further action to ever "pay her debt". (Similarly, it is hard to imagine what Goering or Himmler, say, could possibly have done after the war to "make up" for their crimes, even if they had felt genuine remorse and desire to do so.)
But Karla had done nothing of the sort (people like her never do). She and her "morally progressive" defenders think that the mere fact that she was punished somehow sets things on equal moral terms again between her and "society", when in reality her punishment makes no moral difference whatsoever to her standing with society. Thinking it does isn't moral "progress"--it's moral imbecility.
I would hope that they (who did her in--Sk.) wouldn't get caught.
But if they won't be caught, how would you know who to congratulate and buy a drink for?