An encounter is an object that causes creatures to spawn when a player character enters a specified region within an area. The term can also refer to the creatures spawned (particularly if they are hostile), or more generally to any group of hostile creatures (even if they were not spawned by an encounter object).
Encounters provide several benefits to module builders. Encounters allow a group of (high-overhead) creatures to be initially replaced by a single low-overhead object until the creatures are actually needed, which can be a significant savings for large modules. They also (optionally) allow the same creatures to be spawned repeatedly as players repeatedly enter the designated region. This has some use in single-player modules, and is of great value to persistent worlds, where repeating encounters can be used to prevent a world from being cleared of opponents. The most fundamental benefit of encounters, though, is that they scale to the power of the triggering character. (This is the one aspect of encounters that cannot be easily simulated through other means.) An encounter that is configured properly can spawn creatures appropriate for anyone from a lone level 1 character to a party of level 40s, depending on who triggered the spawns.
Defining an encounter consists of painting the triggering region, much like a trigger is painted (with the exception that an encounter's region is never seen by players). Then various settings controlling what is spawned are defined. In addition, an encounter may have one or more spawn points, which determine where the spawned creatures appear. (If there are multiple spawn points, the one furthest from the triggering character is used. If there are no spawn points, the creatures spawn around the triggering character.) Additional functionality can be created by taking advantage of the various encounter events.
The major setting controlling what is spawned is a list of blueprints for the creatures that could be spawned. Each blueprint in the list can be flagged as "unique", meaning that at most one creature from that blueprint will be spawned (per triggering). Otherwise, the game decides how many creatures to spawn from each blueprint, based on the relative toughness of the creature and the party that triggered the spawns. This is governed by settings specifying the minimum and maximum number of total creatures spawned, along with a "difficulty" setting that controls how much of a challenge the spawned creatures should pose to the triggering party. (The exact algorithm used is inaccessibly hardcoded.)
If an encounter is configured to spawn creatures multiple times, all previously spawned creatures must be killed (or otherwise eliminated) before new creatures will spawn. In addition, a set amount of time must have elapsed since the preceding spawn.