Witness
In law, a witness is someone who, either voluntarily or under compulsion, provides testimonial evidence, either oral or written, of what they know or claim to know.
A witness might be compelled to provide testimony in court, before a grand jury, before an administrative tribunal, before a deposition officer, or in a variety of other legal proceedings. A subpoena is a legal document that commands a person to appear at a proceeding. It is used to compel the testimony of a witness in a trial. Usually, it can be issued by a judge or by the lawyer representing the plaintiff or the defendant in a civil trial or by the prosecutor or the defense attorney in a criminal proceeding, or by a government agency. In many jurisdictions, it is compulsory to comply with the subpoena and either take an oath or solemnly affirm to testify truthfully under penalty of perjury.
Although informally a witness includes whoever perceived the event, in law, a witness is different from an informant. A confidential informant is someone who claimed to have witnessed an event or have hearsay information, but whose identity is being withheld from at least one party (typically the criminal defendant).  The information from the confidential informant may have been used by a police officer or other official acting as a hearsay witness to obtain a search warrant.

Types
A percipient witness (or eyewitness) is one with knowledge obtained through their own senses (e.g., visual perception, hearing, smell, touch).  That perception might be either with the unaided human sense or with the aid of an instrument, such as microscope or stethoscope.
A hearsay witness is one who testifies about what someone else said or wrote.  In most court proceedings there are many limitations on when hearsay evidence is admissible.  Such limitations do not apply to grand jury investigations, many administrative proceedings, and may not apply to declarations used in support of an arrest or search warrant.  Also some types of statements are not deemed to be hearsay and are not subject to such limitations.
An expert witness is one who allegedly has specialized knowledge relevant to the matter of interest, which knowledge purportedly helps to either make sense of other evidence, including other testimony, documentary evidence or physical evidence (e.g., a fingerprint).  An expert witness may or may not also be a percipient witness, as in a doctor or may or may not have treated the victim of an accident or crime.
A character witness testifies about the personality of a defendant if it helps to solve the crime in question.A crown witness is one who incriminates former accomplices in a crime who following receive either a lower sentence, immunity or also a protection of themselves or/and their family by the court. After they have provided the court with their testimony they often enter into a witness protection program.
A secret witness or anonymous witness is one whose identity is kept secret by the court.

Calling a witness
In a court proceeding, a witness may be called (requested to testify) by either the prosecution or the defense. The side that calls the witness first asks questions in what is called direct examination. The opposing side then may ask their own questions in what is called cross-examination. In some cases, redirect examination may be used by the side that called the witness but usually only to contradict specific testimony from the cross-examination.
Recalling a witness means calling a witness, who has already given testimony in a proceeding, to give further testimony. A court may give leave to a party to recall a witness only to give evidence about a matter adduced by another party if the second party's testimony contradicts evidence given by the original witness on direct examination.

Testimony
Witnesses are usually permitted to testify only what they experienced first-hand. In most cases, they may not testify about something they were told (hearsay). That restriction does not apply to expert witnesses, but they may testify only in the area of their expertise.

Reliability
Although eyewitness testimony is often assumed to be more reliable than circumstantial evidence, studies have established that individual, separate witness testimony is often flawed. Mistaken eyewitness identification may result from such factors as faulty observation and recollection, or bias, or may involve a witness's knowingly giving false testimony. If several people witness a crime, it is possible to look for commonalities in their testimony, which are more likely to represent events as they occurred, although differences are to be expected and don't of themselves indicate dishonesty. Witness identification will help investigators get an idea of what a criminal suspect looks like, but eyewitness recollection include mistaken or misleading elements.One study involved an experiment, in which subjects acted as jurors in a criminal case. Jurors heard a description of a robbery-murder, a prosecution argument, and then an argument for the defense. Some jurors heard only circumstantial evidence; others heard from a clerk who claimed to identify the defendant. In the former case, 18% percent found the defendant guilty, but in the latter case, 72% found the defendant guilty (Loftus 1988).Police lineups in which the eyewitness picks out a suspect from a group of people in the police station are often grossly suggestive, and they give the false impression that the witness remembered the suspect. In another study, students watched a staged crime. An hour later they looked through photos. A week later they were asked to pick the suspect out of lineups. 8% of the people in the lineups were mistakenly identified as criminals. 20% of the innocent people whose photographs were included were mistakenly identified.Weapon focus effects in which the presence of a weapon impairs memory for surrounding details is also an issue.
Another study looked at 65 cases of "erroneous criminal convictions of innocent people." In 45% of the cases, eyewitness mistakes were responsible.The formal study of eyewitness memory is usually undertaken within the broader category of cognitive processes, the different ways in which we make sense of the world around us. That is done by employing the mental skills at one's disposal like thinking, perception, memory, awareness, reasoning, and judgment. Although cognitive processes can be only inferred and cannot be seen directly, they all have very important practical implications within a legal context.
If one were to accept that the way people think, perceive, reason, and judge is not always perfect, it becomes easier to understand why cognitive processes and the factors influencing the processes are studied by psychologists in matters of law, one being the grave implications that this imperfection can have within the criminal justice system.
The study of witness memory has dominated the realm of investigation. As Huff and Rattner note, the single most important factor contributing to wrongful conviction is eyewitness misidentification.

Credibility
A credible witness is a person who acts as a witness, including through giving testimony in court, whose testimony is perceived as truthful and believable. Other witnesses may be perceived as less credible, or to have no credibility. Assessment of credibility is made of each witness, and is not affected by the number of witnesses who testify. Several factors affect witnesses' credibility. Generally, witnesses are perceived as more credible when they are perceived as more accurate and less suggestible.At common law, the term could be used in relation to the giving of testimony, or for the witnessing of documents. In modern English law, a credible witness is one who is not "speaking from hearsay." In Scottish law, a credible witness is one "whose credibility commends itself to the presiding magistrate ... the trustworthiness" of whom is good.

Witnessing of wills and documents
Credible witnesses must be used to give meaning or existence to certain types of legal documents. For example, in most common law jurisdictions, at least two witnesses must sign their names to a will in order to verify that it was executed by the testator.  In Canadian law, a credible witness to a Will means a witness who is not incapacitated by mental deficiency, conflict of interest, or crime.

See also
Courthouse facility dog or courthouse dog
Eyewitness (disambiguation)
Eyewitness identification
Eyewitness memory
Informant
Martyr (a word which originally meant witness)
Material witness
United States Marshals Service
Witness protection

References
Further reading
Garraghan, Gilbert J. (1946). A Guide to Historical Method. New York: Fordham University Press. ISBN 0-8371-7132-6.
Gottschalk, Louis (1950). Understanding History: A Primer of Historical Method. New York:  Alfred A. Knopf. ISBN 0-394-30215-X.
Johnson, M. K. (2001). False Memories, Psychology of. IN: Smelser, N. J. & Baltes, P. B. (eds.) International Encyclopedia of the Social and Behavioral Sciences. Amsterdam: Elsevier. (pp. 5254–5259).
Lakatos, I. (1970). Falsification and the methodology of scientific research programmes. In: Lakatos, I. & Musgrave, A. E. (eds.), Criticism and the Growth of Knowledge. Cambridge, UK: Cambridge University Press: 59–89.
Loftus, Elizabeth F. (1996). Eyewitness Testimony. Revised edition. Cambridge, MA: Harward University Press. (Original edition: 1979).
Read, J. D. (2001). Eyewitness Memory: Psychological Aspects. IN: Smelser, N. J. & Baltes, P. B. (eds.) International Encyclopedia of the Social and Behavioral Sciences. Amsterdam: Elsevier. (pp. 5217–5221).
Roediger III, H. L. (2001). Reconstructive Memory, Psychology of. IN: Smelser, N. J. & Baltes, P. B. (eds.) International Encyclopedia of the Social and Behavioral Sciences. Amsterdam: Elsevier. 12844–12849.
Ross D F, Read J D, Toglia M P (1994) Adult Eyewitness Testimony: Current Trends and Developments. New York: Cambridge University Press.
Shepherd J W, Ellis H D, Davies G M (1982). Identification Evidence: A Psychological Evaluation. Aberdeen University Press, Aberdeen, UK
Thompson C P, Herrmann D, Read J D, Bruce D, Payne D G, Toglia, M P (1998). Eyewitness Memory: Theoretical and Applied Perspective. Mahwah, NJ: Erlbaum.

External links

Eyewitness memory
Child Witness Project
Victims and witnesses of crime (Directgov, England and Wales)