During the presentation of evidence, the prosecution presents its case first. In doing so, as each witness is called to testify, the defense may cross-examine the witness immediately after the prosecution’s direct examination. While cross-examination might be helpful to the defense, this is still considered the prosecution’s case.
When the prosecution has presented all their evidence, they will indicate to the court that they “rest their case”.
At this point, the defense can make a motion to have the judge dismiss the case if insufficient evidence has been presented. This is usually only effective if the proseuction fails to present any evidence about, at least, one of the required elements of an offense.
Then, the defense may present their evidence and, if witnesses are called to testify, the prosecution may cross-examine the witnesses.
When the defense has presented all their evidence, if any, they will indicate to the court that they “rest their case”.
With both sides having “rested their case” the prosecution goes first during closing argument and then the defense. However, because the prosecution has the burden of proof, they get to make a rebuttal argument. Thus, the prosecution gets two opportunities during closing argument while the defense only gets to go once.