Your approach is correct.
The first person to arrive has no one with whom to shake hands. The second person to arrive can shake hands with the one person already present. The third person to arrive can shake hands with the two people already present. In general, the $k$th person to arrive can shake hands with the $k - 1$ people already present. Thus, if there are $n$ people present at the party, the number of handshakes is
$$\sum_{k = 1}^{n} (k - 1) = \sum_{k = 0}^{n - 1} k = \frac{n(n - 1)}{2}$$
as you observed in the comments.
Inductive Proof: Let $P(n)$ be the statement that if $n$ people are present at the party and each person shakes the hand of every other person at the party, then the number of handshakes is $\frac{n(n - 1)}{2}$.
Let $n = 1$. Since the first person has no one with whom to shake hands, no handshakes occur. Since
$$\frac{1(1 - 1)}{2} = \frac{1 \cdot 0}{2} = 0$$
$P(1)$ holds.
Thus, we may assume $P(m)$ holds for some positive integer $m$.
Let $n = m + 1$. When the $(m + 1)$st person arrives at the party, the number of handshakes that have already occurred is, by hypothesis,
$$\frac{m(m - 1)}{2}$$
The new guest then shakes the hands of each of the $m$ people present, after which every person has shaken the hand of each of the other people at the party and the number of handshakes that have occurred is
$$\frac{m(m - 1)}{2} + m = m\left[\frac{m - 1}{2} + 1\right] = m\left[\frac{m - 1}{2} + \frac{2}{2}\right] = \frac{m(m + 1)}{2}$$
so $P(m) \Rightarrow P(m + 1)$.
Since $P(1)$ holds and $P(m) \Rightarrow P(m + 1)$ for each positive integer $m$, $P(n)$ holds for each positive integer $n$.
Combinatorial Proof: The number of handshakes is equal to the number of ways that two of the $n$ people present can be paired, which is
$$\binom{n}{2} = \frac{n!}{2!(n - 2)!} = \frac{n(n - 1)(n - 2)!}{2(n - 2)!} = \frac{n(n - 1)}{2}$$
Combinatorial Proof: The number of handshakes is equal to the number of subsets consisting of two of the $n$ people present at the party. We can count these subsets by adding up the number of handshakes performed by each person as she or he arrives at the party. Since the $k$th person to arrive at the party shakes the hand of the $k - 1$ people already present, we may conclude that the number of handshakes that occur when $n$ people are present at the party is
$$\binom{n}{2} = \sum_{k = 1}^{n} (k - 1) = \sum_{k = 0}^{n - 1} k = \frac{n(n - 1)}{2}$$
A variation of this argument was used by al-Banna to derive the formula for $\binom{n}{2}$.
This can be generalized even more. If you have $n$ people, $p_1, p_2,..., p_n$ and you want $p_i$ to shake hands with $a_i$ people, then do the follwoing:
Make a graph in which every vertex is a person and draw an adge between any 2 people that shake hands. Observer that $deg(p_i)=a_i$, $\forall i$, so the number of handshakes, i.e. the number of edges is $$\frac{\sum_{i=1}^{n}deg(p_i)}{2}=\frac{\sum_{i=1}^{n}a_i}{2}$$
Important: for the handskaes to be possible, $\sum_{i=1}^{n}a_i$ must be even.
So to answer your question, if we have $n$ people and each should shake hands with $m$ people, for this to be possible $mn$ must be even and we have $$\frac{\sum_{i=1}^{n}a_i}{2}=\frac{mn}{2}$$
(because $a_1=a_2=...=a_n=m$)
Best Answer
For the $(n,k)$ problem:
What you are looking for are the $k$-regular graphs of $n$ nodes, with node labels, not necessarily connected.
However I couldn't find much for this labeled case. The best I could find (after a few minutes of googling) were the top answer at this MO question and also this other MO question.
The unlabeled case seems to have more literature: A good starting reference might be this wolfram link and this OEIS link. The latter lists $\sum_k f(n,k)$ but cross-references to many different OEIS sequences for fixed $k$.
For the $(8,2)$ problem:
As others have pointed out this is equivalent to partitioning into cycles of length $\ge 3$. It might(?) be easier conceptually if we partition first, then form cycles.
A set of $k$ people can clearly form $k! / 2k$ cycles. The denominator of $k$ accounts for the different start points, and the denominator of $2$ accounts for reflection.
An $8$-cycle: no. of ways $= 8! / 16 = 2520$.
An unordered pair of $4$-cycles: First of all, no. of such partitions $= {8 \choose 4} / 2 = 35$, with the denominator of $2$ accounting for the fact choosing either of the $4$-subset results in the same partition. After partitioning, each $4$-subset gives $4!/8 = 3$ cycles, so total no. of ways $= 35 \times 3 \times 3 = 315.$
A $3$-cycle plus a $5$-cycle: no. of such partitions $= {8\choose 3} = 56$. The $3$-subset gives $3!/6 = 1$ cycle, and the $5$-subset gives $5!/10 = 12$ cycles. Total no. of ways $= 56 \times 1 \times 12 = 672$.
Add them up: $2520 + 315 + 672 = 3507$.