One principle of copyright law is that if you can prove independent authorship, there cannot be liability no matter how similar your work is to the prior work. "If by some magic a man who had never known it were to compose anew Keats's 'Ode on a Grecian Urn,' he would be an 'author,' and if he copyrighted it, others might not copy that poem, though they might of course copy Keats's." (Sheldon v. MGM Pictures Corp., 81 F.2d 49, 54 (2d Cir. 1936)).
Now, of course, the challenge is proving that you've never heard a given piece of music, or never read a particular work of fiction. If you have, even unconscious copying exposes to liability. And if the plaintiff can prove that you had access (such as the scriptwriter who sent a copy to a movie studio), they will have an even easier time proving the copying.
If there is no proof of copying or not-copying, the copying can be proved circumstantially either through expert testimony or the jury's evaluation. The expert might testify something like "There is an identical tonal progression in these two songs, even though they were written in different keys. There were a million different ways the songs could have been written, but they are identical in this respect." The jury can consider that information and find the defendant liable. Or, the judge may simply tell the jury, "You may listen to these two songs, and find the defendant liable if you find them to be substantially similar to the extent that it is more likely than not that the defendant copied the plaintiff."
TL;DR: The process can be conclusive, but if it isn't, then the output will be the evidence that the jury will consider.