Behaviour in Doom is controlled by using a combination of tags and types applied to linedefs and sectors. Tags are used to relate an action, as specified by a linedef type, to the sector (or sectors) which it will affect.
Normally, a tag is an arbitrary non-zero integer, specified in the tag field of linedef and sector entries.
For example, in the northernmost room of MAP01: Entryway (Doom II), there are four platforms with troopers on them; two of the platforms have switches on their sides facing the center of the room. The switch on the eastern platform is implemented using a linedef type of 103 ("switch once: remote door open and stay open") and a linedef tag of 4. In the northeast corner of the room, the wall is actually one side of a sector with a sector tag of 4. Thus, when the switch is activated using the USE key (spacebar by default), the wall in the northeast corner opens like a door.
The other switch in this room is a linedef with type 102 ("switch once: move floor down to highest neighbor floor height") and a tag of 3. The four platforms all have different sector numbers, but they all have a tag number of 3. Therefore, activating the switch lowers all four platforms.
The Boom engine greatly extended the number of sector and linedef types, as well as introducing behaviours that involve things.