Witnesses appear to tell the court what they saw this is called evidence. There are prosecution witnesses (to try and prove the defendant is guilty) and defence witnesses (not guilty). Whether a witness is called as a prosecution or a defence witness depends on which side thinks their evidence is most helpful to their case.
During a trial a witness cannot wait in the courtroom as they are not allowed to hear the evidence being given by other people. When a witness is called they will stand in the witness box. In a Crown Court this will usually be facing the jury. The witness will then take the oath which means they swear to tell the truth, the whole truth and nothing but the truth.
The witness will give their evidence through answers to questions. If they are appearing as a prosecution witness, the prosecution lawyer will ask questions first. The defence lawyer will then ask their questions this is called cross-examination. If the witness is a defence witness, then the defence lawyer will question first and then the prosecution.