Typically held soon after arraignment, a preliminary hearing can be understood as a "trial before the trial" at which the judge decides whether there is enough evidence to force the defendant to stand trial. In making this determination, the judge uses the "probable cause" legal standard, deciding whether the government has produced enough evidence to convince a reasonable jury that the defendant committed the crimes charged.
In reaching this probable cause decision, the judge hears arguments from the government (through a government attorney, or "prosecutor"), and from the defendant (usually through his or her attorney). The prosecutor may call witnesses to testify, and can introduce physical evidence in an effort to convince the judge that the case should go to trial. The defense usually cross-examines the government's witnesses and calls into question any other evidence presented against the defendant, seeking to convince the judge that the prosecutor's case is not strong enough, so that the case against the defendant must be dismissed before trial.
A preliminary hearing may not be held in every criminal case in which a "not guilty" plea is entered. Some states conduct preliminary hearings only when a felony is charged, and other states utilize a "grand jury indictment" process in which a designated group of citizens decides whether, based on the government's evidence, the case should proceed to trial. Last but not least, the possibility always exists that any time prior to the preliminary hearing a criminal case will be resolved through a plea bargain between the government and the defendant.