Legal questions would depend on the country you're asking about, as every country is different.
Race, as opposed to ethnicity, is generally considered to be a physical characteristic - i.e., it's not something that describes the culture you were raised in, but that describes yourself genetically - or at least, personally.
It is however still considered, at least in the United States, to be something you mostly define on your own. If you consider yourself white, you are white. If you consider yourself black, you are. Same for mixed race.
Cases where there are exceptions to this are primarily where there are specific benefits based on race - specifically, things like scholarships. There the scholarship may have a specific rule ("must have at least one grandparent" or similar). But even in most of those cases it's very hard to say, and most of those are thus based on ethnicity rather than race. Racial preferences as far as affirmative action are nearly always based on self-reported race, and thus it's up to you what you consider yourself.
If you are aware of your biological parentage, you could of course find out what race your parents are/were, and determine yours from that. If you're unaware, you should consider yourself whatever race you think is appropriate; you could consider genetic testing if you wish in order to find out what race(s) you share the most DNA with, but that is likely not necessary unless you wish to know.
Ultimately - you should make a choice based on what you feel. Applications for jobs or university will allow you to make your own choice, and will not second-guess you for it.