I guess it depends on what you are referring to as ‘male’ or ‘female’, as it may be one’s sex or gender. If it is one’s sex, then that is a little more straight forward, as it depends on what physical traits and sexual organs you have that define that (although you can go through a sex change to become a male or become a female). If you are referring to one’s gender identity, then that is a bit more tricky, as people may wear non-stereotypical clothing, have different haircuts, or even look like a male or female, but you can never really tell. It is always safest just to ask if you are unsure, as most people do not mind, and to those who do mind what they are referred to as will really appreciate you asking rather than assuming 🙂
There are a couple of aspects to this question. Firstly, it depends if you are talking about sex or gender. There is a bit of controversy surrounding this topic but I would define them differently with sex being your biological state and gender being your social state.
One way of knowing if your sex is male or female is to look at your chromosomes. Humans have 23 pairs of chromosomes but sex is determined by only 2. Females have two X-chromosomes and males have one X-chromosome and one Y-chromosome. This can get a bit blurry because there are some individuals that have multiple sex chromosomes so can be XXY for example.
Another way to judge is based on sexual characteristics like external genitalia, body hair and body type. But again, this is not set in stone and there are individuals who cannot be easily categorised into one or the other.
That’s one reason why many people separate gender and sex and let people choose their own gender. Some people go further to say that gender is not just split into female and male but is, in fact, a spectrum. These questions are more social and societal ones and so not at all my area of expertise so I’d encourage you to make up your own mind!