When can you file a motion for summary judgment?
A party may file for a summary judgement after one side of the complaint has presented all the facts and compared all the facts from both sides of the dispute, then argued that "there are no 'triable issues of fact.'" A court will award summary judgment when it is proven that the facts are "indisputable" and that the opposing side could not "prevail" in a trial, in other words, the opposing could not win a favorable judgment in a trial.
In a court case the two big questions are 1. what is the dispute over the facts and 2. what is the dispute over the law. Strictly speaking a trial addresses disputes of fact. Disputes of law are addressed by preliminary objections, motions for judgment on the pleadings, and summary judgment motions to name a few. Summary judgments are usually filed after the pleadings are closed and discovery is concluded; usually right before a trial is set. But, summary judgment does not need to act as a trial substitute. It can be used to narrow the issues by eliminating claims that are pleaded but just don't pan out. A summary judgment motion essentially says to the judge there are no material facts in dispute and given these facts the law says I will win.
A common use of summary judgment is in medical malpractice claims where a plaintiff is required to prove through a medical expert that a standard of care for a treatment was breached. If the plaintiff fails to obtain an expert and open that expert up to discovery by the defendant, the defendant moves for summary judgment after all the discovery deadlines have passed because the plaintiff would then be barred from procuring an expert. Without an ability to prove their claim, a summary judgment would end the case.