Not everybody agrees on this. 'They' has been used as a singular, gender-neutral pronoun for quite some time. However, we still use it in the same manner as the plural 'they'. For example, we would say "he doesn't" but "they don't, even if the 'they' is singular. For this reason, using 'themself' in a sentence can sound incorrect alongside the rest of the sentence.
Cambridge dictionary defines 'themself' this way:
used when the subject of the verb is "they" used as a singular pronoun, or a single person who could be any sex, and the object is the same person
This definition is consistent with most style guides. But it only really tells you when you can use 'themself' - there is nothing ungrammatical about using 'themselves' for a singular individual. To sum up - it isn't a strict case of using one or the other; rather, you can use 'themselves' in any instance and be grammatically correct, but you can use 'themself' if you wanted to make it clear you were talking about an individual, or perhaps for other reasons, too.