I do feel compelled to say that I am not a lawyer. With that said...
The purpose of the grand jury is to examine the facts of the prosecution's case and decide if there is probable cause. The US Constitution requires a grand jury to be used in all federal and capital cases, with certain exceptions related to the military during wartime. About half of the states use grand juries for their own cases. The grand jury system was created in Amendment V of The Constitution of the United States of America. The relevant passage:
"No person shall be held to answer for a capital, or otherwise infamous crime, unless on a presentment or indictment of a Grand Jury, except in cases arising in the land or naval forces, or in the Militia, when in actual service in time of War or public danger..."
A grand jury is selected in much the same way as a regular jury, but they are not checked for biases like a regular jury is. Once a grand juror is selected, he or she must sit for five days a week for a period of a month. If a large and complex case requies it, a grand juror may be required to sit fewer days week for a much longer period of time, up to three years.
Grand jury proceedings are done in secret. The jurors, the prosecutor, and the stenographer are sworn to secrecy, and no recording devices are allowed within the courtroom. This is intended to protect the jurors from various external pressures, so as to help avoid problems like perjury and witness tampering. Witnesses, on the other hand, are not sworn to secrecy. This is to allow them to defend against rumors and the like after the case.
It is said that the purpose of the grand jury is to protect the accused from the state. In practice, grand jury proceedings are largely a formality. Since only the prosecution makes its case to the grand jury, and since the prosecution may decide exactly which facts to present, the chance of a case being dismissed in the grand jury is relatively low. However, if a case is defeated in the grand jury, it may be presented to it a second time. Double jeopardy does not apply to the grand jury. However, special permission is required from the Assistant Attourney General to try a case twice, and it is very unusual for a prosecutor to even want to try a second time.
A witness in the grand jury may be required to testify against themself. To avoid trouble with the fifth amendment (the very same amendment that created the grand jury in the first place), this testimony may not be used against that witness in an actual trial, in a technicality called a grant of immunity.
A grand jury trial is very unlike a normal trial. A judge is actually not required to be in the courtroom for a grand jury trial, as the normal rules of evidence don't apply. The prosecutor is basically in complete control of the proceedings, deciding what is presented and what is not. As the only thing the jury has to decide on is probable cause, the accused is not allowed to present any evidence in his favor. Actually deciding guilt is the purpose of a normal trial.