Skip forward to below the "=====" for the answer that you're probably looking for. Read the first part to find out why I put it after the "=====".
To make sense of this, you need to think about probability spaces. And to do that right, you need more information about the meaning of the words in your question.
Case 1: There's a distribution $d$ from which the hats for each person are drawn independently randomly. The players guess black/white uniformly randomly. In this case, the expected number of correct guesses is 50 out of 100.
Case 2: There's a distribution as before, again with independent drawing of hat colors, but the players get to look at others' hats before guessing; they then guess black with a probability proportional to the number of black hats they see (out of the total 99 hats they see). (Roughly: if 95 others have black hats, and 4 have white hats, you guess "black" 95 out of 99 times (perhaps by rolling a die to generate your guess). The expected number of correct guesses in this case is always at least 50, but can be far greater. If the distribution $d$ is highly skewed, this strategy wins big. Note that the players are still "guessing randomly" here ... just not uniformly randomly.
Case 3: The hat-placer is an adversary, and has thought about strategies you might employ. The hat-placer carefully chooses a number $k$ of black hats and $100-k$ white hats, and then distributes these randomly among the players by picking uniformly randomly a permutation of the numbers 1...100. (Note that this still meets the condition "that was put on their head randomly"). The players guess uniformly randomly from "black" or "white", without observing the others' hats. The expected number of correct guesses is again 50.
Case 4: Same adversarial setup as in case 3, but the players use the 'bayesian' approach of case 2. In this case, the adversary will presumably optimize, which will turn out to set $k = 50$, and again the expected number of correct guesses is 50.
====
Anyhow, case 2 makes the point that saying what distribution is being used in each step of randomness in the problem is critical to assessing expected values. Just saying "randomly" doesn't guarantee uniform randomness. And "straight guesses" doesn't actually mean much of anything to me, although I'm guessing that to you it means "uniformly randomly chosen from 'black' and 'white'."
Let me ramble on a little further still, and formulate the problem a little differently.
You have a fixed but unknown list of 100 bits, $b_1, \ldots, b_{100}$, each either a $0$ or a $1$.
You generate another list of 100 bits, $c_i$, $i = 1, \ldots, 100$, chosen independently identically distributed from the uniform distribution on the set $\{0, 1\}$.
You ask "What is the expected number of $i$ for which $b_i = c_i$?"
The answer in this case is $50$, and does not depend on the initial bit sequence $b$. The proof is straightforward: the probability space consists of all possible $c$-sequences; there are $2^{100}$ of these, each equally probably.
If we look at the $i$th digit of each of these sequences, in half of them $c_i$ is zero; in the other half, $c_i = 1$. Hence the probability that $c_i$ equals $b_i$ is exactly $1/2$, and the expected value of the event $c_i = b_i$ is $1/2$. By linearity of expectation, the expected number of matching bits is the sum of the expected number of matching first-bits, matching second-bits, and so so, hence is $100$ times $1/2$, or $50$.
This statement is false
in any group of people, the number of people who have shaken hands with an EVEN number of other people from the group is even."
For the simplest example just take a party where no people shock hands. Zero is still an even number.
The handshake lemma is a direct consequence of the lemma that says the number sum of degrees of the vertices in a graph is double the amount of edges:
Image of lemma
Now split the summation into two parts the sum of odd degrees call it O and the sum of even degrees call it E. We know that E + O = 2e which is an even number so they must either both be even or odd ,but E is always even since the sum of even numbers is always even. So The odd degrees must be of an even amount in order for us to obtain an even amount. ex: 1+1 = 2
This translates to the odd degreed vertices being in an even amount or that in a party there are an even number of people who have shaken odd hands.
Best Answer
Let $P_k$ be the person who shook $k$ hands. $P_{2n-2}$ shook hands with everyone but his or her partner, so $P_0$ must have been the partner. Set them aside, leaving $P_1,\dots,P_{2n-3}$ and the mathematician. Each of these remaining people shook hands with $P_{2n-2}$, so within the group that remains each shook one hand fewer: $P_k$ shook $k-1$ hands for $k=1,\dots,2n-3$. By the same reasoning (or by induction) $P_1$ and $P_{2n-3}$ must be a couple. In general we must have $P_k$ and $P_{2n-2-k}$ forming a couple for $k=0,\dots,n-2$. In particular, $P_{n-2}$ and $P_n$ are a couple. This leaves $P_{n-1}$ to be the mathematician’s husband: he shook $n-1$ hands.
In graph-theoretic terms we have a graph $G_n$ with vertices $v_k$ for $k=0,\dots,2n-2$ such that $\deg v_k=k$, and we have an additional vertex $v$ corresponding to the mathematician. The graph is simple (no loops or multiple edges), and it is known that the vertices can be partitioned into $n$ pairs whose members are not adjacent. We wish to show that $v$ is paired with $v_{n-1}$. This is clearly the case when $n=1$, so assume that $n>1$.
Vertex $c_{2n-2}$ is adjacent to every vertex but itself and the one paired with it, so every vertex but the one paired with it has positive degree; thus, $\{v_0,v_{2n-2}\}$ must form a pair. Remove $v_0$, $v_{2n-2}$, and all adjacent edges, and you have a graph $G_{n-1}$ on $2(n-1)$ vertices with mutatis mutandis the same properties. By the obvious induction hypothesis vertex $v$ is paired with the vertex of degree $n-2$ in $G_{n-1}$, which is $v_{n-1}$ in $G_n$, as desired.