Although Rowling often wrote Quidditch as a plot-forwarding device rather than a sport with coherent rules, she's been surprisingly consistent about this one rule.
After a regular goal
In Prisoner of Azkaban, it appears that possession does change after a goal (emphasis mine):
["]Flint in possession, Flint flying toward the Gryffindor goal posts, come on now, Wood, save -!"
But Flint had scored; there was an eruption of cheers from the Slytherin end, and Lee swore so badly that Professor McGonagall tried to tug the magical megaphone away from him.
"Sorry, Professor, sorry! Won't happen again! So, Gryffindor in the lead, thirty points to ten, and Gryffindor in possession -"
Prisoner of Azkaban Chapter 15 "The Quidditch Final"
This is kept consistent in Order of the Phoenix:
'Slytherin score!' came Lee's voice amid the cheering and booing from the crowds below, 'so that's ten-nil to Slytherin - bad luck, Ron.'
The Slytherins sang even louder:
'WEASLEY WAS BORN IN A BIN
HE ALWAYS LETS THE QUAFFLE IN...'
' - and Gryffindor back in possession and it's Katie Bell tanking up the pitch -
Order of the Phoenix Chapter 19: "The Lion and the Serpent"
So it appears that possession really does changer after a team scores.
This seems consistent with Quidditch's historical development; before 1883, the goalposts we're used to seeing in Quidditch matches replaced the traditional baskets, a diagram of which (from Quidditch Through the Ages) is included below:

Although the size of the baskets was rarely standard between pitches1, presumably the Keeper would have to retrieve the ball after a successful goal, at which point their team would immediately take possession. It makes sense to have retained this rule for historical purposes, if nothing else.
For what it's worth, I think you're misinterpreting the remark that "Flint scored...without anybody noticing." The final score of the game (170-60 in favour of Gryffindor) is consistent with Flint's five goals (emphasis mine):
"Slytherin in possession - Flint with the Quaffle - passes Spinnet - passes Bell - hit hard in the face by a Bludger, hope it broke his nose - only joking, Professor - Slytherins score - A no...
[...]
Marcus Flint seized the Quaffle and scored five times without anyone noticing.
Philosopher's Stone Chapter 11: "Quidditch"
Harry catches the Snitch very shortly after this, so it's highly unlikely that there were other goals we weren't informed of. Apparently, Flint's goals were legal, if unsporting.
Since Lee Jordan announces the proper score, clearly at least he noticed the five goals. I always interpreted the line as a hyperbole. The text itself gives no indication that anyone other than the Weasley twins and the crowd were distracted by Harry:
[Harry's] broom was vibrating so hard, it was almost impossible for him to hang on much longer. The whole crowd was on its feet, watching, terrified, as the Weasleys flew up to try and pull Harry safely onto one of their brooms
Philosopher's Stone Chapter 11: "Quidditch"
My own interpretation of the line is that nobody in the crowd noticed Flint score five goals, but they were otherwise legal; possession was changed appropriately, but Flint was able to quickly steal the Quaffle back.
After a penalty shot goal
There's a conflict here; in Philosopher's Stone, Gryffindor keeps possession after a penalty:
"All right, all right. Flint nearly kills the Gryffindor Seeker, which could happen to anyone, I'm sure, so a penalty to Gryffindor, taken by Spinner, who puts it away, no trouble, and we continue play, Gryffindor still in possession."
Philosopher's Stone Chapter 11: "Quidditch"
However, the opposite happens in Prisoner of Azkaban after Marcus Flint takes a penalty shot:
"'Course, Wood's a superb Keeper!" Lee Jordan told the crowd as Flint waited for Madam Hooch's whistle. "Superb! Very difficult to pass - very difficult indeed - YES! I DON'T BELIEVE IT! HE'S SAVED IT!"
[...]
"Gryffindor in possession, no, Slytherin in possession - no! Gryffindor back in possession
Prisoner of Azkaban Chapter 15 "The Quidditch Final"
Prisoner of Azkaban is a little different, though, because both Gryffindor and Slytherin were penalized; Gryffindor took their shot before Slytherin did. Because Gryffindor's penalty was unequivocally deliberate (Fred hit Flint in the head with his beater's bat after Flint "accidentally" barrelled into Angelina), that may have been a contributing factor in possession reverting to Slytherin; it's unclear how this is determined.
In comments, childcat15 suggests an alternate interpretation: Gryffindor gets possession after Slytherin's penalty because Flint didn't score. This is certainly possible, and is as good a theory as any; we don't have any basis for comparison.
Interception
This is probably the most obvious one; players are able to grab the Qauffle while it's in the air, and of course the Keeper can pass it to anyone if they catch it while making a save.
I could add a quote, but I think this one is sufficiently uncontroversial that I don't need to.
Slightly less obvious is that the Quaffle may be physically removed from a Chaser's grasp, as long as the opposing player doesn't grab hold to the Chaser in possession. This rule is described in Quidditch Through The Ages:
- The Quaffle may be taken from another players' grasp but under no circumstances must one player seize hold of any part of another player's anatomy.
Quidditch Through The Ages Chapter 6: "Changes in Quidditch since the Fourteenth Century" section "Rules"
Rule Violations
According to Quidditch Through the Ages, violating at least one of the rules will result in a turnover (emphasis mine):
- Though there is no limit imposed on the height to which a player may rise during the game, he or she must not stray over the boundary lines of the pitch. Should a player fly over the boundary, his or team must surrender the Quaffle to an opposing team.
Quidditch Through The Ages Chapter 6: "Changes in Quidditch since the Fourteenth Century" section "Rules"
Rebounds
If the Keeper successfully blocks a shot, but the Quaffle bounces off their hands and beyond their reach, I'm not sure what would happen. In most sports where scoring is determined by putting an object past a person and into a metal aperture (basketball, hockey, association football, etc.), possession would go to whichever team reaches the ball first. However, Quidditch Through the Ages suggests that this is unlikely in modern Quidditch, thanks to a charm on the Quaffle:
With the discovery of Gripping Charms in 1875, however, straps and finger holes have become unnecessary, as the Chaser is able to keep a one-handed hold on the charmed leather without such aids.
Quidditch Through the Ages Chapter 6: "Changes in Quidditch Since the Fourteenth Century" Balls
I'm not sure what would happen in other rebounds, such as if the Quaffle bounced off one of the goalposts. I don't believe this has ever happened in canon (possibly in the movies, but I don't recall), but it seems likely that possession would fall to whoever grabs it first.
Out of Bounds
As mentioned above, players are not allowed to cross the boundary lines of the pitch, so there must be something that happens if the Quaffle goes out of bounds. There doesn't appear to be a canon source identifying what happens, but in most similar sports the ball goes to whichever team did not cause the ball to go out of play2. In particular this is the case in Association Football, which is probably where Rowling got a lot of her ideas about Quidditch.
1 There's an amusing anecdote about this in Quidditch Through the Ages, where a representative of the Department of Magical Games and Sports recounts one team:
[T]hey've got these minuscule little baskets attached to he opposing team's posts [where the visiting team would have to score], you couldn't get a grape in them. And up their own end they've got these great wicker caves swinging around.
2 It's not surprising to learn that American Football is the major exception to this rule; a ball that goes out of bounds causes the currently-offensive team to lose a "down." If you're not familiar with the rules of American Football (and really, who can blame you), all you need to know is that possession changes after 4 downs.