Sizing is a really important aspect of choosing a bike that will provide a good cycling experience. A poorly sized bike can cause health problems and can make cycling an unpleasant drag.
There does not seem to be a universal standard for bike sizing due to the variety of designs and geometry. Size varies between manufacturers and intended use; touring, racing and commuting bikes and needs are all slightly different.
Most brands will have a guideline to get you in a range. However, one brand may place you solidly on a 58cm frame, but a different brand might place you between a 58 and a 60.
Developing a good relationship with your local bike shop is a good opportunity to try out different sizes and frames and get measured up for the right one to suit you. This is especially useful if you have non standard body geometry. You can also customise the fit to the nature of your riding such as racing, endurance or comfort.
The traditional scheme for sizing a road frame was “standover height”. You’d stand with your feet flat on the ground, straddling the bike. If you had “comfortable” (for a male) clearance of the (traditionally-positioned) top tube then the bike was the right size. This is by no means a steadfast rule but it is a good starting point. There are other aspects of fit, such as “reach”, that usually follow overall fit, but not always.
Seat height test
Put your heel on the pedal with your leg stretched out straight. It should not be locked out. That should be approximately the right seat height.
Seat fore / aft
Hold a plumb line from the prominent bone in front of and below knee. It should go through the ball of the foot. Move the seat fore and aft position to adjust.
Reach and stack height
Try swapping stems get the right reach (amount you have to lean to the handlebars). Sit on the bike and check your hand position, feel if it might be more comfortable an inch or so forward or back.
Try adding headset spacers to get the right stack height (the height of the handlebars).
WARNING: There is a limit to this adjustment. Too much indicates your bike probably is the wrong size.
Test the bike!
Ride the bike for at least 20 miles 10 times. You really have to test ride several sizes and brands to see what fits. Ride the bike on and off road (if it is a mountain bike).
Bike fit is trial and error if you do it yourself. Of course you can make adjustments to your frame or buy a different sized frame. With all that taken into account you might want to skip these steps and just go to your bike shop for a bike fit.