State statute determines who can be a witness, but there are some general tendencies that genealogists need to be aware of.
A witness to a document usually needs to be of sound mind and of legal age. They also should have no direct interest in the document. For example, an heir to a will should not be a witness. And the grantor or grantee on a deed should not be a witness either.
Sometimes one will hear that one witness was from the wife's side and one was from the husband's side, etc. There may be times where that happens, but it is not a hard and fast rule. A witness is saying that "I saw you sign that document and I know who you are." That's it.
Of course, witnesses to wedding may be relatives and one may be a relative of the groom and one may be a relative of the bride. And of course, the brother of a man may witness his will, as long as the brother is not a legatee or an heir. And if the man writing the will has children, the brother is not an heir. If the brother is not mentioned in the will he is not a legatee either.
A witness is only saying "I saw you make your mark." It is worth remembering.