Generation of a cyclic group of prime order
One way to do this, if you're working with a multiplicative group $Z^*_p$, is to pick a prime $p$ so that $p-1$ has a large prime factor $q$; once you have this, then to generate a generator of order $q$, you pick a random value $h$, compute $g = h^{(p-1)/q}$, and if that is not 1, then $g$ is a generator of your group.

Obvious questions:


How do you find a large prime factor $q$, given that $p-1$ is hard to factor?  Well, you pick the prime factor $q$ first, and you look for a prime $p$ in the form $kq+1$.
How likely is it that $h^{(p-1)/q} \ne 1$?  Well, if $h$ is selected randomly from the range $[1, p-1]$, that will be one with probability $1/q$, and so you'll almost always get a usable $g$ with just one random $h$.


Another way to do this is pick a prime $p$ with $q = (p-1)/2$ also prime and $p \equiv 7 \pmod{8}$.  In this case, $g=2$ is guaranteed to be a generator of order $q$.  This is a bit more work, however you can use the primes $p$ from this RFC; all those primes have these properties.