How does Ulam's argument about large cardinals work?
You can find the proof in any set theory book that covers measurable cardinals. For example Jech's "Set Theory" and Kanamori's "The higher infinite".
First the idea is to show that the measure is not $\sigma$-additive, but rather $\kappa$-additive. Namely, the union of less than $\kappa$ sets of measure $0$ is still measure $0$.
If this is not true, then there is a partition of $\kappa$ to $\{X_\alpha\mid\alpha<\gamma\}$ with $\gamma<\kappa$, all of which has measure $0$, and consider the function $f\colon\kappa\to\gamma$, $f(x)=\alpha$ if and only if $x\in X_\alpha$. Then you can show that $f$ induces a $\sigma$-additive measure on $\gamma$, contradiction to the minimality of $\kappa$.
From this follows that $\kappa$ is regular, since if it were singular, we could have partition it into $<\kappa$ parts of size $<\kappa$, and by $\kappa$-additivity and lack of atoms, each of the parts would be measured $0$ and so would their union.
It suffices to show that $\kappa$ is not a successor. For this we use the notion of an Ulam matrix, I'll keep the definition to the minimum here and only define a $(\lambda,\lambda^+)$-matrix.
A $(\lambda,\lambda^+)$-matrix is a collection of sets $\{A_{\alpha,\beta}\subseteq\lambda^+\mid\alpha<\lambda^+,\beta<\lambda\}$, such that:
- If $\alpha\neq\alpha'$ then $A_{\alpha,\beta}\cap A_{\alpha',\beta}=\varnothing$ for all $\beta<\lambda$.
- For each $\alpha$, the set $\lambda^+\setminus\bigcup_{\beta<\lambda}A_{\alpha,\beta}$ has cardinality at most $\lambda$.
Namely, each column (fixed $\beta$) is a family of disjoint sets, and each row is "almost" everything.
If we show that there is a $(\lambda,\lambda^+)$-Ulam matrix, and its existence implies that $\lambda^+$ doesn't carry a $\lambda^+$-additive measure, then we can safely conclude that $\kappa$ cannot be a successor cardinal.
Now for each $\xi<\lambda^+$ pick a function $f_\xi$ whose domain is $\lambda$ and $\xi\subseteq\operatorname{rng}(f_\xi)$, and define: $$\xi\in A_{\alpha,\beta}\iff f_\xi(\beta)=\alpha.$$
I will leave this to you to verify that $\{A_{\alpha,\beta}\mid\alpha<\lambda^+,\beta<\lambda\}$ defines a $(\lambda,\lambda^+)$-Ulam matrix. Let's use it to show that $\lambda^+$ doesn't carry a $\lambda^+$-additive measure:
Assume otherwise, then for each $\alpha$ there is some $\beta$ such that $A_{\alpha,\beta}$ has measure $1$ (by the second condition of the matrix). But now the function $G(\alpha)=\min\{\beta\mid A_{\alpha,\beta}\text{ has measure }1\}$ is a function from $\lambda^+$ to $\lambda$, so there is some $\beta<\lambda$ such that $G^{-1}(\beta)$ all have measure $1$, which is impossible since $A_{\alpha,\beta}\cap A_{\alpha',\beta}=\varnothing$ for $\alpha\neq\alpha'$.
Suppose $m$ is a $\kappa$-additive 2 valued measure on $\kappa$ (so $\kappa$ is regular). If $\kappa$ is not inaccessible then for some $\lambda < \kappa$, $2^{\lambda} \geq \kappa$. Let $F: \kappa \to 2^{\lambda}$ be injective. For each $\sigma \in 2^{< \lambda}$, let $X_{\sigma} = F^{-1}[\{x \in 2^{\lambda} : \sigma \subseteq x\}]$. Construct $x \in 2^{\lambda}$ such that for each $\alpha < \lambda$, $m(X_{x \upharpoonright \alpha}) = 1$. Now, by $\kappa$-additivity, $m(F^{-1}[\{x\}]) = 1$ which is impossible.