I'm a Bachelor student (third year) and I'm having trouble with the definition of word in group theory. From Wikipedia (our professor also gave us a similar definition):
Let G be a group, and let S be a subset of G. A word in S is any expression of the form ${\displaystyle s_{1}^{\varepsilon _{1}}s_{2}^{\varepsilon _{2}}\cdots s_{n}^{\varepsilon _{n}}}$ where $s_1,\ldots,s_n$ are elements of S, called generators, and each $ε_i$ is $±1$. The number $n$ is known as the length of the word. Each word in S represents an element of G, namely the product of the expression. By convention, the unique identity element can be represented by the empty word, which is the unique word of length zero.
My question is: how is defined $s^{-1}$ for a certain $s\in S$? Maybe it is just notation and I'm confused for nothing, but I don't get it: if $S$ is any subset (not necessarily a subgroup / group) of $G$, what exactly the inverse of an element is and why it exists. Is it just a formal notation and nothing else?
Sorry for the dumb question but I didn't find any information online, thanks in advance :)