Each is a Quantifier, a part of speech that wasn't discovered until the 19th century, too late to get into the Top Eight list, which was canonized much earlier. Quantifiers are a form of Determiner (another POS), and they "bind" noun phrases, which means they modify and quantify them. Like most noun modifiers, quantifiers are naturally found before the noun they modify.
Like many quantifiers, however, each is subject to a syntactic rule called "Quantifier Shift" (aka "Quantifier-Float" or "Q-Float"), which moves a quantifier from a prenominal position to an adverbial position:
- Each of the boys said they would go. == Q-ShiftFloat ==> The boys each said they would go.
Q-ShiftFloat applies to the quantifier all as well as each, but not to the quantifier every:
- All the boys said they would go. == Q-ShiftFloat ==> The boys all said they would go.
- Every boy said he would go. == Q-ShiftFloat ==> *The*The boy(s) every said he/they would go.
As to the question...
In the first sentence in the question, that each have 4 strokes is a relative clause modifying letters, with that as the subject relative marker, and a Q-ShiftedFloated each.
In the second sentence, each has 4 strokes is half of a compound sentence, a main clause with each as its subject.
Each (and, again, all, but not every) can act as a pronoun substituting for (in this case) each letter, in the same way this can substitute for this letter.