Well, it's been months since I've written or thought much about D&D, and a lot longer since I've actually played it, but I've recently been mulling the idea of writing and publishing some sandbox adventure settings. In that vein, I've been thinking a bit about adventure design: specifically, encounters. Not combat encounters vs. roleplay encounters or anything like that, but the big picture way in which encounters are integrated into the matrix of space, time, randomness, and player agency that makes up the game.
The encounter types listed below may be incomplete, but at least serve to illustrate how the different types of encounters serve different purposes. A good mix of encounter types ensures a balance between DM preparedness, unexpected twists and complications that enrich the game, and respect for player agency.
Random: An encounter that occurs when and where the dice dictate, fixed neither in time nor space. It is procedurally generated during play by rolling to determine if an encounter occurs at all, and then determining the type and number of monsters appearing by rolling on a list or table. The classic Wandering Monster rolls of early edition D&D are the most prominent example. Done well, random encounters add an element of uncertainty, helping to apply time and resource pressure to the players and prompting the DM to think creatively when the dice produce unexpected or incongruous results.
Keyed: Fixed in space but not time. At a specific room or hex on the map, a specific type and number of monsters are present. Regardless of when the PCs enter the area, those monsters are there. Probably the single most common type of encounter found in classic published modules and homebrew adventure settings. Use of keyed encounters allows the DM to be familiar with the denizens of an area and anticipate possible strategies and courses of events.
Conditional: An encounter occurs after a specific event happens. While this is perhaps the most common encounter type in a railroad scenario, used properly it can be valid in a sandbox setting as well. The triggering event ideally should be something the player-characters do, and it should be something in which they have a real choice. If they desecrate the tomb, an avenging spectre appears at midnight wherever they are. If they steal the baron's treasure, a heavily armed contingent of the baron's men seek them out. If they recover a dangerous relic, a sage meets them shortly after their return to town warning of its peril.
The second caveat for using a conditional encounter in a sandbox campaign is that the players' choices must be taken into account when determining where, when, and if the encounter occurs. The spectre may not appear if the party takes refuge in a holy place for the night. An encounter with the baron's men might go quite differently if the party makes a beeline for the coast and boards a ship immediately after their heist. The encounter with the sage may be delayed if the PCs take their time returning to civilization, or head off in a direction the DM didn't anticipate. Just because an encounter can take place only after a triggering event doesn't necessarily mean it must take place.
Conditional encounters allow the DM to plan consequences for particularly important and likely player actions.
Compounded: An encounter can be modified by combining the above types in some way.
A keyed encounter may be modified by conditions such as time (modification of another encounter type is the only case in which the players' choices need not be the conditional trigger.) For instance, the guard post may be manned by goblins at night and brigands during the day. The owlbear may leave its den to hunt at night. The cultists might gather in the shrine for a ritual during the hour after dusk, leaving their usual keyed locations mostly deserted.
Keyed encounters could also be conditionally modified by player actions. If a goblin sentry escapes to alert the rest of the lair, the denizens may gather together in some areas for safety in numbers, leaving some locations overstocked and others empty.
Keyed encounters can be modified by randomness; e.g. a 2-in-6 chance each day that half the goblin warriors go out raiding, or a 25% chance that the captain is inspecting the sentry posts and not in his quarters.
Random encounters can be linked to keyed encounters, for instance if entries in the random encounter tables specify e.g. "1d6 goblins from location 5," with monsters defeated subtracted from the keyed location.
Random encounters can be modified by conditions, either independent of player action (different encounter chances and/or monster tables for day and night or different weather conditions,) or caused by player actions (double chances of encountering a goblin patrol for 12 turns after the sentry escapes to warn its fellows.) Even the common practice of increasing the odds or frequency of rolls to check for encounters when the party makes a lot of noise qualifies.
Conditional encounters may be modified by randomness, e.g. determining where they plan to meet or ambush the party, or how successful they are at tracking the party if the PCs elude them.