Factor set of algebra extension 
Let $k$ be a field. Let
  $$ 0\to M \to E \to A \to 0$$
  be a short exact sequence of $k$-algebras with $M^2=0$. As $k$-vector spaces we have $E\cong M\oplus A$, given by some section $s\colon A \to E$. But the multiplicative structure is not the direct sum (unless $s$ is an algebra morphism). The product in $E$ is then given by
  $$ (a,m)(b,n):=(s(a)+m)(s(b)+n)=s(a)s(b)+s(a)n+ms(b)+mn$$
  and using $M^2=0$ and adding/substracting $s(ab)$, we get
  $$ s(ab)+s(a)n+ms(b)+g(a,b). $$
  We call $g(a,b):= s(a)s(b)-s(ab)$ the factor set. By applying the second map of the sequence we see that in the previous expression $s(ab)\in A$ and the rest is in $M$, so we have (continuing with the abuse of notation)
  $$(a,m)(b,n)=(ab,an+mb+g(a,b)).$$

I think there is something that I am not understanding correctly here. The notes I am following say that $g(a,b)$ should be $s(ab)-s(a)s(b)$ instead, and I assumed it was a typo. But then the notes claim also that the unit in $E$ is given by $(1,-g(1,1))$ with this description, and I cannot see how this works. Since $(a,m)(1,-g(1,1))=(a,m-ag(1,1)+g(a,1))$, we would need that
$$ s(a)(s(1)s(1)-s(1))=s(a)s(1)(s(1)-1)=s(a)(s(1)-1)=s(a)s(1)-s(a). $$
But why is this true? It seems like we would want $s(a)s(1)=s(a)$ to conclude, but this is precisely the reason why we need to talk about the factor set, because this isn't true, right?
 A: I agree with you that $g$ is given by $g(a,b) = s(a)s(b) - s(ab)$.
I’m not sure where your equations
$$ s(a)(s(1)s(1)-s(1))=s(a)s(1)(s(1)-1)=s(a)(s(1)-1)=s(a)s(1)-s(a) $$
come from, but I think that $(1, -g(1,1))$ is indeed the multiplicative unit of $E$:
The equations
\begin{align*}
     (a,m) (1, -g(1,1))
  &= (a, m - ag(1,1) + g(a,1)) \\
     (1, -g(1,1)) (a,m)
  &= (a, m - g(1,1)a + g(1,a))
\end{align*}
tell us that we need to show that
\begin{equation}
\tag{$\dagger$}
  ag(1,1) = g(a,1)
  \qquad\text{and}\qquad
  g(1,1)a = g(1,a).
\end{equation}
We know* that the the associativity of $E$ is equivalent to $g$ being a Hochschild $2$-cocycle, i.e. that
$$
  a g(b,c) + g(a, bc) - g(a,b) c - g(ab, c) = 0
$$
for all $a, b, c \in A$.
By setting $a = b = 1$ and $b = c = 1$ we then get the desired equations
$$
  g(1,c) = g(1,1)c
  \qquad\text{and}\qquad
  a g(1,1) = g(a,1).
$$
Note that we have not used the description of $g$ in terms of $s$.

 * I assume that you’re reading Pieter Belmans’ notes on Hochschild (co)homology, so I will not explain this further unless requested. 
