Are those words pure synonyms or is there any difference? What would be the most obvious usage of those words?
Inadvertently is a synonym of unwittingly in that they refer to an unintentional act. Unwittingly also has the denotation that one is unaware of the act.
: not knowing : UNAWARE
kept the truth from their unwitting friends
This may be too fine a line for a reader to see in many contexts.