First, how is Raavana a rakshasa and a brahmin at the same time? Second, if Raavana is Brahmin, how is he the king of Lanka? Since one's caste was determined based on one's karma, I would think Raavana to be a Kshatriya by that logic.
Basically, the 4 varnas (Brahmana, Kshatriya, Vaishya, Shudra) exist in every jati (deva, manushya, gandharva, rakshasa, pishacha)
So, we can have Deva Vaishya, manushya Kshatirya, Rakshasa Brahmana etc.
e.g. Ravana was Rakshasa jati & Brahmana varna. Shukracharya is Deva Brahmana. Chitrangadha is Gandharva Kshatriya.
Next, both birth & character determine one's varna. Normally, either one alone is not sufficient.
e.g. Drona was brahmana but fought in Mahabharata, Koushika was kshatriya but did severe penance for thousands of years and converted into brahmana (Vishvamitra).
How is Raavana a Rakshasa and a Brahmin at the same time?
Raavana was son of Vishrava. And Vishrava was the son of Pulatsya and the grandson of Brahma. So by this logic he was Brahmin.
But he was Rakshasa because:
Vishrava (Ravana's father) cursed Kaikashi (Ravana's mother)
His mother was from Rakshasas (his mother Kaikashi was daughter of Rakshasa Sumali)
He joined his maternal grandfathers/uncles who were from Rakshasas and became king of Rakshasas
A Brahmana is not Brahmana by birth alone. He, it is said by the wise, in whom are seen those virtues is a Brahmana. And people term him otherwise in whom those qualities do not exist, even though he be a Brahmana by birth.
These four points are described in details here.
How is he the king of Lanka?
This is described here:
Lanka was built by Vishvakarma. Malyavan, Sumali and Mali used to live in Lanka. Later they attacked Devas and Lord Vishnu came to fight with them. Lord Vishnu killed Mali. Seeing Mali slain, Sumali and Malyavan, burning in grief, led precipitately towards Lanka along with their forces. But Lord Vishnu didn't stop killing Rakshas. And albeit inlated with pride, they, incapable of coping with Vishnu, leaving Lanka, went to the nether regions (Rasatala) with their wives for dwelling there.
Then Kubera started living in Lanka.
Later Sumali encouraged his daughter Kaikesi to marry Visrava. Coming to know that his daughter's sons, Dasanana and his two brothers, got powerful boons (Dasanana was incapable of being slain by Nagas, Yakshas, Daityas, Danavas and the Devas) form Lord Brahma, Sumali shed all his fear of Vishnu and came out from Rasatala. Later Sumali encouraged Ravana to take Lanka back from Kubera. Vishrva advised Kubera to leave Lanka and build another city name Alkapuri on Kailash mountain which Kubera accepted.
And Ravana became the king of Rakshasas and started living in Lanka.
Since one's caste was determined based on one's karma, I would think Raavana to be a Kshatriya by that logic.
By karma also, he was Rakshasa only. Kshatriya's duties are to protect the society and not to trouble them.
One way to see it would be in terms of psychology of a person. Where Rakshasa means a person with hightened Ego Not to think of Rakshasha as some terrestial being But instead a human being with Bad qualities
Whereas real meaning of Brahmin is different but here probably it is meant that Ravana is a Brahmin because he was a Shiv Bhakta or religious. Well being relgious does not mean that a person doesnt have any ego. You can see in the world people going to temples and cheating others or harming others. One can be Brahmin by taking birth in a brahmin family. But his psychological makeup may be totally destructive to others... and may be a terrorist.
As per what i have read the real meaning of Brahmin is one who has realized Brahman or Atman. But nowadays this term is used loosely.