Both Ramayan and Mahabharat are two great epics of Indian history and both have taken place in entirely different time-periods.
While Ramayan happened in Treta Yuga (the second Yuga), Mahabharat is the story of Dwapar Yuga (the third Yuga) having huge gap of time in between them (millions of years). Still to the surprise of many, there were 15 such characters in Indian history who have been a part of both Ramayan and Mahabharat.
Ravana is better known and remembered as the demon king who kidnapped Sita whom Rama defeated and killed, in a battle fought at Lanka.
Ravana played his role as a villain, but it was that of a much-needed villain, that brought balance to the equation. No wonder there are many people in the world, who still worship him.