Lots of adventures include subsystems. By "subsystem," I mean any kind of rules system that stands outside the core rules of the game and is useful for (and perhaps specific to) a particular adventure or campaign. One of the most well-known is Paizo's Kingmaker adventure path, which uses a complicated set of kingdom-building rules so the players can grow their empire as their characters advance in levels. But a subsystem can be simple and add a lot to your adventure. Here are 3 straightforward examples:

* Trail of Clues: As the players investigate a villain's crime spree they earn "clue points" for interrogating thugs or finding clues. They have plenty of sites to investigate, with 1 to 2 clue points available at each. They learn the location of the villain's hideout eventually, regardless of how many clue points they gain. But at 2 points, the villain sends a single assassin after the players (who can also yield a clue point), at 4 points the villain sends some of his most potent agents (who are therefore unable to help defend the villain in his lair), and at 6 points they learn the villain's key weakness.

* Powered By Blood: In a shrine where good priests have been possessed by bloodthirsty demons, the players earn a "blood point" for each good priest they kill (rather than, say, knock unconscious). Sipping from befouled fonts and similar acts also earn blood points. Their number of blood points fuels the demon boss in the main temple, granting it a bonus to attack and damage rolls against the heroes equal to the number of blood points acquired.

* Overland Chase: The players must attempt certain skill checks to traverse a wilderness quickly, acquiring "haste points" on a success. Certain encounters also allow them to gain more haste points (not falling prey to quicksand, for example, or swiftly defeating the vanguard of a horde of pursuing undead). Their number of haste points lets them catch up to their quarry, or even get ahead and set an ambush if they acquire a lot of haste points. 

I like these subsystems; they're a bit of a game within a game. I use them in my own adventures, and I've encouraged freelancers I commission to use them in their adventures as well. But here's some advice on how to use them well.

* Don't Over-Complicate Them. PC actions resulting in "points" of some kind (as in the examples above) is straightforward, and triggering events with the point score is easy. Another simple example is to give the players some advantage (a bonus on Initiative, or Perception, or attack or damage rolls) equal to the points they acquired. In one adventure I wrote, the players earned points for doing dangerous or selfish things (or failing certain saving throws), and they more points they individually acquired, the more penalized they were against the final boss. Adventure subsystems shouldn't be too complicated, unless they're the heart of the whole game (as the Kingmaker rules are). The game itself already puts a cognitive load on the players, and a much larger cognitive load on GMs, so something that's easily scored on a piece of scratch paper works best.

* Let Players Play, Too. I'm surprised that most adventures with subsystems don't state whether the GM ought to share the subsystem with the players. Perhaps it all happens behind the screen and allows the GM to weave the narrative a bit better, and that's just fine, but I think informing the players really builds their engagement. They ought to know whether they're amassing points, for example, although they might not know what the points do. Or maybe they know that, too. Paizo's Hell's Vengeance adventure path has one adventure where the players are building Despair points to get a town to give up. My group knew exactly when they got them, but not how many they needed for scripted events (shops closing, people leaving town, etc.) to happen. Another adventure in that campaign has the players accumulating Rebellion Points in a town they already control. Gaining Rebellion Points is bad, and the players need to avoid doing that--although they don't know what rebel actions will occur at which point thresholds.

* Make It Relevant. I recently wrote a long adventure with five sub-parts. One of the sub-parts was about an evil nightmare person twisting a benign location into a nightmare reality. At certain points, the players might "see past" this nightmare reality and gain "clarity points," which they use against that nightmare person. The clarity points weren't useful anywhere in the adventure other than this nightmare sub-part, and that served to set apart that sub-part from the others. 

* The Subsystem Need Not Be Necessary. Some GMs don't like subsystems, and some players gain a strange joy in subverting them. If your adventure works just fine even if the subsystem is jettisoned or botched, that's probably for the best. That gives the GM more flexibility. My first two examples above are like that--the adventure occurs regardless of the points the players gain.

* ...But If It Is, Test The Subsystem! If the players must use the subsystems to advance the plot--such as if they only get to meet the queen by acquiring enough nobility points or if they only catch up to their quarry with enough haste points--you should consider what both horrible player failure looks like (failure to succeed at skill checks, failure to piece together clues, failure to influence key nobles, etc.) as well as what unexpected player success looks like (if they critically succeed at every skill check they make, etc.). Both boundaries should move the adventure forward, even if the lower boundary makes the players' lives a bit harder--or even a lot harder. Your adventure must not fail because your subsystem doesn't work. The Starfinder vehicle rules aren't really a subsystem, but I really feel they don't work. In a recent vehicle chase in a home game I'm playing, we spent 30 minutes reviewing the chase rules, then our pilot rolled a very high result and the enemy pilot rolled a very low result. With that, the chase was then over. In only two rolls. That's a subsystem that doesn't work. So test both the abysmal failure and ultimate success well, knowing that most groups will land in the middle but outliers are inevitable.