- For the API function, see API_select.
Selecting a unit is the act of identifying it as a player's target in the game interface, typically by clicking on it or pressing the Tab key. Technically this is called targeting, but saying "select" can be used to specify that the player is simply identifying the unit within the interface rather than starting an in-world action targeted at it. A mob's AI routine may also select units, but this is usually called "targeting" since no human input is involved.
Selecting can also be a synonym for interacting - selecting a target and initiating an action on it, often either talking or auto-attacking (depending on hostility level), almost always by right-clicking on it.
Left clicking a PC, NPC, or mob will select it. Right clicking will select it too, but also initiates direct interaction, so be wary when selecting enemies. The Tab key targets and selects attackable units in front of the player, and macros can step through targeting/selection choices via the /target command and other targeting functions.
Clicking on a mount that is being ridden will almost always select the character, not the mount. The mount is in effect a rather large extension of the unit, displayed under the unit. A few mobs disobey this rule, and have mounts that can be targeted separately from themselves. This rule also doesn't apply to vehicles, although some of them prevent the occupant(s) from being targeted. A selectable object in front of another unit will prevent players from clicking on the obscured unit to target it, but those units can still be selected using the Tab key, macros, or sometimes simply by changing the camera angle.
Once selected, the player's target becomes the default target for any spells cast by the player and any commands used by the player, the target's name will be used in any emotes (and macros using the %t substitution), and other players will be able to see that the player has selected that target. The target is highlighted in the game world with their name appearing above them and a selection circle around them. The color of the circle and the name indicates hostility - red is aggressive, yellow is passive until attacked, and green is "non-combatant". Their portrait appears next to the player's portrait at the top of the screen, and can be right-clicked for a number of options such as trading, whispering, dueling, inspecting or kicking a target player, or setting a focus target or raid icon on any unit. If "Target of target" is enabled in the interface options, any unit the target has selected will also be displayed!
Right-clicking interacts with a unit or object, and if it is a unit, selects it - objects cannot be selected. There's also a key binding that can interact with a selected target (and therefore does not work on objects). Interacting is entirely dependent on the type of unit or object clicked on.
With friendly NPCs, most commonly it will open a dialog if the NPC has a dialog for the player, often including quest options and completion. These interactions will change the cursor to a speech bubble, exclamation point, or question mark when hovering on the target. Other possibilities include a bag or anvil cursor for vendor and repair NPCs, a book for trainers, or a winged boot for flight masters. Hostile attackable NPCs and neutral mobs will show a sword icon, and right-clicking will activate the character's auto-attack with equipped weapons. Neutral NPCs vary in how they respond. Neutral vendors will generally open a dialog. Many are not interactable, and unattackable hostile NPCs are often the same way - although some can be spoken to.
Other units may not be NPCs at all, and are more akin to fixed objects. These and true objects vary even more widely in interaction effect, but often display a gear cursor for any number of purposes. Objects include mailboxes, chests, and doors. Because they must be right-clicked on, interacting with objects can be extremely difficult if there are visual obstructions between the player's camera and the object, including crowds of other players. Zooming in the camera as much as possible and standing right next to the object can sometimes cause the obstructions to be hidden, allowing interaction.
Objects and hostile units that show no special icon when hovered upon cannot be interacted with directly. However, events affecting these objects may still be triggered by the player, such as interacting with a lever object to open a door.