There are many ways to put n elements in k sets. Do you want the set sizes to be similar to each other?
A naive approach would be n/k elements per set. This is not always an integer, but you can fix this by rounding in an appropriate way.
You could add 1 element at a time to each set, cycling through all the sets as you add elements. If the number of elements isn't an multiple of the number of sets, you just run out of elements before cycling through all the sets on the last cycle.
Is there a 'distance' function, a way to quantify how close or how similar two items are (so that you place similar items in the same set)? (Examples would be assigning customers to their closest service center, or grouping objects of similar colors.)
If this sounds like the case, it may be a clustering problem; one possible algorithm, not difficult to implement, could be this one. (Or, for a clearer explanation that Wikipedia, see here.)
We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling We Value Civility
• Positive and compassionate attitudes
• Patience while debating We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving