Q:

What does "wherein" mean exactly?

I have encountered wherein several times in many texts, and the general meaning of the texts was quite evident given the context.
However, I do not know the exact meaning of wherein; a dictionary search returns "How, or in what way; Where, or in which location; During which" (Wiktionary).
But what are the contexts it can be used in, and is there any weird way it is being used sometimes? (I realised by now that English can be tricky.)
Also, are there any differences concerning this word between American and British English (my preferred)?

A:

'Wherein' is generally only used in formal writing. The Oxford English Dictionary gives the following senses and quotes. I have given the most recent quote, from which you can tell that the word is no longer generally used.

In what (thing, matter, respect, etc.)?
1891 - Oh, Britannicus! wherein have we offended?
In which (place, material thing, writing, etc.)?
1888 - Peering keenly into the shadow wherein she stood
In, at, during, or in the course of which (time).
1819 - Length of days Wherein to act the deeds which are the stewards Of their revenue.
In which (matter, fact, action, condition, etc.); in respect of which.
1889 - There began a round of pleasure for Julia wherein she was the central figure.
Into which.
1585 - We came to an anker very nigh the castle, wherin when our patrone would followe vs [etc.].

A:

It's perhaps less common than it was before, but in general the construction of a preposition followed by a demonstrative or relative pronoun "this/these", "that/those", or "which/what" may be inverted by prefixing the preposition with "here-", "there-", or "where-", respectively.

in which == wherein
   from that == therefrom
   by this == hereby
   after this == hereafter
   for which, for what, why == wherefore
   for that [reason etc.] == therefore
   on that == thereon
   to this == hereto

The inversion of a preposition in this manner is shared at least one other Germanic language, namely Swedish.

