Let $\Sigma$ be a connected oriented bordered/unbordered surface. Let $\widehat\pi(\Sigma)$ be the set of all free homotopy classes of loops in $\Sigma$.
For a closed curve $\alpha\colon \Bbb S^1\to \Sigma$, we write $\text{cls}(\alpha)$ to denote the free homotopy class of $\alpha$.
The Goldman bracket $[-,-]\colon\Bbb Z\big[\widehat\pi(\Sigma)\big]\times\Bbb Z\big[\widehat\pi(\Sigma)\big]\to \Bbb Z\big[\widehat\pi(\Sigma)\big]$ is defined as follows:
Let $x,y\in \widehat\pi(\Sigma)$ be represented by two smooth oriented loops $\alpha, \beta\colon \Bbb S^1\to \Sigma$, respectively, such that $\alpha \sqcup \beta \colon\Bbb S^1\sqcup \Bbb S^1\to \Sigma$ is a self-transverse immersion without triple points.
Thus given any point $p\in \alpha\cap \beta$ there is an open negihborhood $U$ of $p$ such that $U\cap (\alpha\cup \beta)\cong (\Bbb R\times 0)\cup (0\times \Bbb R)$.
Let $\alpha*_p\beta$ be the loop obtained by resolving the intersection point $p$ following the rule:
start from $p$, go around $\alpha$ (follow orientation) until you come back to $p$, then go around $\beta$ (follow orientation), and finally stop at $p$.
Now, define $\varepsilon_p\in \{+1,-1\}$ as follows: Choose $v_p\in T_p \alpha$ and $w_p\in T_p\beta$ which represent directions of $\alpha$ and $\beta$, respectively.
If the ordered pair $(v_p, w_p)$ represents the orientation of $\Sigma$ at $p$, then let $\varepsilon_p:= 1$, otherwise let $\varepsilon_p:= -1$.
Finally, define $$[x,y]:=\sum_{p\in \alpha\cap \beta}\varepsilon_p\cdot \text{cls}(\alpha*_p \beta).$$
Goldman, see [Gol86], showed that the bracket is a well-defined bi-linear map that is skew-symmetric and satisfies Jacobi identity.
Further, if $\alpha$ is a simple closed curve and $x:= \textup{cls}(\alpha)$, then for $y\in \widehat \pi(\Sigma)$, $[x, y] = 0$ if and
only if $y=\textup{cls}(\beta)$ for a closed curve $\beta$ such that $\beta\cap \alpha=\varnothing$.
Reference