There’s three general schools of thought on the subject.
First, is that they’re like their video game counterparts; instead of having a computer that handles all the player input, it’s handled by another player. And instead of a controller, players interact with the game by announcing what they want to do.
Second, they’re board games that need a little bit of assembly. The rulebook has an assortment of rulings for different situations, and one person uses them to set up a scenario for the players to go through. The classic example is “go into this cave and beat up all the monsters inside.”
Figurines and maps are available from most RPG publishers, though there’s also plenty of third parties that sell them, and also no shortage of 3D models that can be assembled using a 3D printer.
Third, they’re the games of pretend that we played as a kid. Though they have a rulebook and a referee to make them less likely to devolve into shouting matches of who does what.
All are valid explanations, and none really invalidate any of the others.
The bottom line is this, though: one person plays the role of the Game Master. They listen to the players as they announce their character’s actions. The Game Master then replies with the results, and may ask for dice to be rolled if the action the player character took is best left up to chance.
Tabletop RPGs have a rulebook that all players are expected to read, which includes how to make a character, what characters can typically do, and when dice should be rolled.
It’s most important for the Game Master to know all these rules, since they’re the one running the game and enforcing the rules.