Many languages in the world have gender or noun class system, typically the distinction is 3 or less are genders while more are classes but it's nothing solid. Some conlangers do not wish to add it but this is a guide for those who do.
Why do languages have gender?
There are many hypotheses and explanations on why languages have gender. One such explanation is that it gives an easy method to make new words from existing ones, example includes Spanish "médico" for doctor, with the familiar -o at the end it's masculine, we can exchange it to formmédica to refer to a female doctor. The more probable reason for this assignment is to induce redundancy into the language. In normal speech redundancy is something to be avoided but in communication and information redundancy is a necessary component to secure the transfer of information. Even computer information, such as QR-code and programming, includes redundancy, a good example of what happens is the Atari Jaguar CD when the redundancy is not enough.
We humans live in a very noisy environment so there is a need to secure that information gets across properly and gender is one of many methods to do this by adding this redundancy. For example "The red boy and girl", is the boy the only one who is red or are both red? In English it is ambiguous but with gender assignment it can be done so it only applies to one of them. Other more complicated examples include north american languages where the verb tells you everything about who is doing what and nouns able to float around and shift places but has no marking on their semantic roles in the sentence, the verb encodes all information of their gender or more animacy but gender works well here. So it can be used to free up word order.
What genders to have?
About 50% of all languages don't have genders so it's certainly an option to skip it, the remaining 50% do and within these, 50% have a simple animate vs inanimate distinction, that is 25% of all languages. The remaining 25% have all the crazy fun. A key note is that while animate and inanimate are often very semantic it doesn't need to be as things can get promoted or demoted by analogy. Indo-European languages have the masculine, neuter and feminine distinction, which has fused in various ways over time in various languages. Other languages have many more of all kinds, you are quite free to have any gender system you feel like.
How do I assign the gender?
This depends somewhat on your gender system to begin with. No gender system is entirely arbitrary but no system is neither entirely semantic but they can lean one way or another. If the assignment is semantic it will depend on what the noun is and how, from the point of view of a speaker, it relates to the noun classes that do exist and what is considered the prototypical element of that class. If it's arbitrary it goes really in any of the classes. Abstractions are a category that tend to be entirely arbitrary but they can become semantic by analogy.