There are several relevant measurements for a chain, some more relevant than others:

pitch

distance between rollers centres - always the same (1/2"/12.7mm) on modern bikes

internal width

distance between the inside plates - varies by small increments depending on the number of gears on the bike drivetrain from single speed to 11 speed - 3/32" and 1/8" are common sizes - see https://en.m.wikipedia.org/wiki/Bicycle_chain for a list of common widths

external width

greatest outside width of the chain; often this turns out to be the width of the pins (that go through each roller and connect the plates). This width varies for 3/32" chains, and the width required depends on the number of speeds that the chain needs to work with on the rear cog cluster

length

defined by the number of links in the chain

Contents

Bikes with just one cog in back -- single-speed, fixed-gear/fixed wheel, and internally geared bikes like 3-speeds -- traditionally use 1/8" chains if the chainwheel and sprocket are 1/8, but use 3/32" chains if they are 3/32. So, get the correct width, but if in doubt, get 1/8" as it will work on 3/32 chainwheels and sprockets but it's not ideal. A 1/8" chain will not work correctly on a derailleured bike. A 3/32 will not work on a 1/8 chainwheel and sprocket.

The external width matters for derailleur-equipped bikes because rear cogs are spaced close enough together such that a chain that's too wide will rub on adjacent cogs.

So, the width of chain required basically depends on the number of cogs (speeds) in back, since clusters with more speeds have their cogs spaced closer together.

In general, drivetrains up to and including 8 speeds can use the same speed chain. The packaging/marketing chains often don't mention that they work with 5, 6, 7, or 8-speed bikes -- but if it mentions compatibility with any of these speeds, then it is compatible with all. The pin width of these chains is usually 7.1 or 7.2mm.

9-speed drivetrains use chains up to 6.8mm wide. These are typically explicitly marketed as 9-speed chains.

10-speed drivetrains use chains up to 6.2mm or so wide. Again, these are marketed as 10-speed chains.

It is usually possible to use a narrower chain on a fewer-speeds drivetrain, but beware of narrow 9-speed and above chains with old chainsets as the chain may drop between the rings when changing down to the inner ring. There's no significant benefit to doing so though since 9- and 10-speed chains are more expensive.

The length of a loop of roller chain can be defined in two primary units: pitches and links. A pitch of chain is the center-to-center distance between two rollers. A link of roller chain is the smallest segment of chain that can be removed from a loop of chain and still allow the loop to be reconnected. A link is exactly two pitches of chain, which includes one set of outer plates and one set of inner plates. If a single pitch of chain needs to be removed, the ends of the loop will need to be reconnected with a special type of master link called a half link. A half link performs the job of the outer plates on one of its ends, and the job of inner plates (and roller and bushing) on its other end.

On a derailleur-equipped bicycle, the chain must be sized so that the drivetrain can be shifted into the large-large combination of front and rear gears, and so that in the small-small combination of front and rear gears that there's no sag in the chain and also no rubbing between the two pulleys of the rear derailleur.

One of the simplest ways to size a chain is described by Sheldon Brown on his website. In short, thread the chain tight around the large-large sprocket combination, but not through the rear derailleur. Find the tightest point where you could connect the ends of the chain. From that point, count out one more link of chain (which will be one inch when dealing with bicycle chain) to determine the total number of links required. Once the chain is shortened to this point and installed on the bike, it is long enough to handle all possible gear combinations.

The other common ways of determining chain size are described in detail on the informative Park Tool website.