Here are some more concrete details from an analysis of the reverse-engineered Roller Coaster Tycoon 2 source code, provided and maintained by the OpenRCT2 project.
The basic rule is that when a peep visits a ride, the peep will decide either to enter the queue for the ride or not, based on a whole bunch of different criteria. Once 25 peeps have made that "go on the ride or not" decision, the game takes the number of peeps who decided to go on the ride, multiplies by 4, and that's the ride's new popularity percentage.
There are some surprising exceptions to this, though:
First, only peeps who are actually standing in front of the ride when they make the decision get counted. Peeps often make plans about where they're going and what they want to do next, and consider exactly the same set of things in deciding whether or not they want to travel to a particular ride as they do when deciding whether they want to get on, once they arrive. If they decide that they don't want to interact with the ride and so don't ever travel to it, they don't get counted in the popularity value at all, even though they decided that they didn't like the ride for some reason. They weren't standing at the ride when they made the decision, so they don't count, in terms of ride popularity.
Even more surprisingly, peeps who choose not to get on a ride because its intensity rating is too high for them don't get counted in the popularity value at all; they're simply ignored from the counting, and are treated as if they hadn't made a decision at all. (peeps who choose not to get on because its intensity rating is too low do get counted)
Additionally, peeps who are feeling nauseous from previous rides and who decide not to get on this ride because they're feeling unwell also are not counted. (peeps who feel fine and choose not to get on the ride because its nausea rating is too high are counted)
Finally, peeps who can't afford the price of the ride, or who are trying to leave the park, or who choose not to go on a ride because it doesn't have E/I/N ratings yet or because it's broken down or closed aren't counted.
In general, high popularity means that most peeps walking past the ride who are capable of getting on the ride have chosen to do so. Low popularity usually means that the price is too high, or the ride isn't intense enough, or its nausea rating is too high. (Alternately, it may be that the ride is still considered unsafe after an earlier accident, or that the ride isn't sheltered enough from the rain.)