Bicycles may have nominal sizes, e.g. extra small through extra large, or they may have a centimeter size (e.g. Specialized's road frames in 2021 have 44cm, 49cm, 52 to 58cm in 2cm increments, and 61cm). Manufacturers usually recommend a range of heights for each size.
In the past, road frames typically had equal length seat and top tubes, and their top tubes were parallel to the ground (as in the picture in the header). The frame's centimeter sizing corresponded to the length of the seat tube. Mountain bike frames had sloping top tubes (i.e. not parallel to the ground) from the beginning, and most road frames adopted a similar design. Modern road bikes' centimeter measurements do not typically correspond to their seat tube lengths. Frames with sloping top tubes may be called compact frames, and they look like the picture below.
Height ranges are an approximate guide. People can have relatively long legs for their height, or the reverse. Your local bike store will be able to help you determine the correct size in person.
X- and Y- dimensions
If you are sizing yourself, there are two schemes to measure frame size. It is important to know how long the bike is (i.e. the length on the X-axis), and how tall it is (i.e. the Y-axis). Once you know a range of bicycle sizes in either measurement scheme that work for you, you can select potential bikes more easily. Keep in mind that you can also adjust the stem length and its vertical height to alter the position of your handlebars.
The effective top tube length (diagram below) measures the former. This is what the top tube length would be if the bike had a level top tube; most new bikes these days have sloping top tubes, and the degree of slope can vary. The bike's seat tube length is the other parameter to know in this scheme. Beware that seat tube length can be measured to the center of the seat tube/top tube junction, or to the very top of the seat tube. There can be as much as a 20mm difference in length between the two types of measurement. A geometry chart will typically state if seat tube is measured center (of the bottom bracket shell) to center or center to top.
Now, manufacturers also provide stack and reach dimensions. These measure the bike's horizontal and vertical dimensions from the center of the bottom bracket to a point at the top of the head tube. This takes the seat tube angle out of the equation, discussed below.
Keep in mind that typical ranges of x- and y-dimensions for a given size will vary by bicycle discipline (e.g. endurance road bikes have lower reach and greater stack than road race bikes; many modern MTBs are designed for short stems and flat bars, so their reach dimensions will be long compared to road bikes) and by manufacturer.
Bike design paradigms
There are systematic differences in body position among bicycle types. To some extent, they can be summarized as the ratio of stack to reach. Performance-oriented or race-oriented road bikes tend to favor long and low body positions. Some more leisure-oriented riders might not be able to achieve their ideal positions on a bike that is too racy. They may be better off on endurance road bikes, which generally favor more upright and less stretched out torso positions that are more comfortable.
Among gravel bikes, many are built like endurance road bikes. However, many also take design cues from MTB geometry. MTBs and MTB-oriented gravel bikes tend to favor relatively long top tubes and are designed for short stems. This aids handling in rough off-road terrain.
There is no shame in riding a less racy bike. Riders should seek a position that is comfortable for them, even if they are on a race bike.
Seat tube angle and seatpost setback/offset
Bicycles typically come in a small range of seat tube angles (STAs) for a given size range. Frames for average men usually have STAs around 73 degrees, with the angles steepening on smaller bike sizes and slackening on larger sizes. Some bikes, particularly mountain and triathlon bikes, may give a virtual STA. This is the STA if the bike had a straight seat tube. The steeper the STA, the further forward you sit on the bike, although remember that you can adjust your saddle position fore and aft. STA does affect the effective top tube length, but not the reach. A steeper STA pushes the whole top tube forward, so the reach would be longer.
Seatpost setback or offset describes if the saddle rail clamp is in line with the post (i.e. 0 offset or straight, commonly seen on mountain bikes), or if it is to the aft of the centerline of the seatpost (15-20mm rear offset is common on road bikes, although there may be some posts with more). Seatposts with setback position your saddle further aft by default.
Most riders should be able to achieve their ideal saddle fore-aft position on most combinations of STA and offset. As always, there may be exceptions for unusual body proportions and/or preferences. For example, if you prefer a very far forward position (e.g. you have short legs or you just prefer it), you may want a zero offset seatpost regardless of frame seat angle. It is possible that you may not be able to get your saddle far forward enough on some frames with slacker STAs. The reverse is true if you prefer to sit further aft; you may want to default to a setback seatpost, and avoid frames with steep STAs. Secondarily, the size of the seatpost's rail clamp can reduce the amount of fore-aft adjustment available.
Do note that STA does interact with top tube length but not with reach. If you fix the top tube length, a steeper STA will give you longer reach.
Head tube length
This affects how much vertical adjustment you can make to your handlebar position. This is less of a concern if your frame size is correct. It is possible that you might have to use excessive spacers (e.g. over 40mm, but see your bike manufacturer's guidelines) to get your handlebars high enough to be comfortable. However, if you need to do this, it may be a sign that you're on the wrong size of bike or on the wrong type of bike (e.g. you should be on a endurance road bike rather than a performance road bike).
This is the distance from the ground to the top tube. On bikes with sloping top tubes (i.e. most of them), clearance is usually stated from the ground to the center of the top tube. When wearing cycling shoes, you can measure the distance from the floor to your crotch and compare.
In the past when road bikes had level top tubes, if you had about an inch of standover clearance, that was a potential indicator that the frame was the correct size. This is not as important as the other basic frame measures.
Almost all road bikes are sized around 700c wheels. For shorter riders, e.g. under about 5'4" or 163cm, smaller wheels like 650B or 650c may be more appropriate. The smaller stock frame sizes will tend to have more toe overlap, i.e. the front wheel can hit your foot when you turn it. This can often be adapted to, especially on road bikes when you only turn the wheels at very low speeds. However, it can also be disconcerting. Some major manufacturers offer smaller bikes in smaller wheel sizes, but not all do.
Riders with body proportions significantly outside the norm may wish to consider a custom frame at some point. Many custom frames are obviously expensive, but not all are. You can ask around your local bike shop for any local framebuilders they know of, or search the internet.
Frame geometry and handling
While this is not directly related to stack and reach, other parameters of the frame's geometry affect how it handles. A more complete discussion is here, but frame geometry is complex. One oversimplification is that bikes can be made more stable (more effort to initiate a turn, bike tends to remain upright, easier to ride hands-free) or more agile (less effort to initiate a turn, bike feels like it dives into the turn).