To generate them equally spaced out based on the number of colors wanted. Something that looks like this if 8 is given for the count specified:
List
You can also take a look at Rich Newman's HSLColor class. He has a series of blog posts on it, starting with this one.
Using this code I was able to generate a series of colors evenly spaced around the color wheel, but you'll have to add additional logic if you want to include shades of grey.
private void button1_Click(object sender, EventArgs e)
{
listView1.Items.Clear();
int step = 240 / 8;
for (int i = 0; i < 240; i += step)
{
HSLColor color = new HSLColor((double)i, 240, 160);
listView1.Items.Add(i.ToString()).BackColor = color;
}
}