Is there a best practice for centering your handlebars in the stem? Besides eyeballing it, I actually tried measuring distances but found that depending on where I measured from and to I got different results. For example, the screw in the cap to the top of the hoods would show they are off by one amount but measuring to the end of the bars would show a different amount. Is there a most true set of landmarks to use? Does it depend on the quality of the bars? Does it even matter?
It sounds as though you have drop bars, and one of your measurements is to the brake hoods. Since those are independently attached to the handlebars, that measurement only tells you that something is off, not what it is (you have two measurements and three unknowns - the bar position in the stem, the left brake level position on the bar and the right brake lever position on the bar).
I assume there are no markings on the bar, and no bulge where the bar thickens to 25mm from 22mm, otherwise you wouldn't be asking?
I suggest loosening the stem off and making a mark on the centre point of the bars, measuring from a point that has a sharp edge. If the bars are new the end of the drops is good, but on old bars one or both end is often bent a little. Even 5mm makes a noticeable difference here. If the bars have been taped the tape will also affect the measurement, which is why the bar end points are good.
But regardless, the next best way to measure is from the inside of the forward-swept part of the bars. Get a ruler that's longer than the width of the bars and place it on top of the bars, at 90° to the bike's long axis (across the handlebars). Line it up parallel to the bars, so that it's just in front of the cross part. and the same distance forward on both sides. I find that lining up the forward edge of the bars and the back edge of the ruler works well. Then measure off the forward edge of the ruler, since that's on the straight parts of the bars.
Here's a quick top view:
Ideally your bars will not curve this much, or you'll use a wider ruler :)
This lets you measure the exact width of the bars. Halve that, and measure in that far from one side. That's the centre :) Now make a mark there, or better still, mark the ruler and centre the bars in the stem with it in place. A couple of rubber bands can be used to hold the ruler in place while you do this - put them on the rule, put the ruler on the bars, pull a band under the bars and over the end of the rule. Repeat for other side. Now wiggle the bars in to position. Test ride, and make sure it feels right.
Mark with a permanent marker both sides of the stem so you can line it up easily next time.
Also, now if you repeat your measurement to the brake hoods you can twist one or both on the bars to get them symmetrical. If you prefer them that way.
This also works for most other curly bars.
Usually handle bars have a set of grooves in the middle to grip onto the head stem. When these grooves are wider than the head stem it's easy - just center them so that the same amount is visible on each side.
I guess you wouldn't be asking if it was that easy.
Loosen the bars and slide them sideways to see the grooves, and make a mark with a pencil or marker on each side of the grooves, with the same gap on each side. Make sure that you'll be able to see the marks when you slide the bar back into the head stem.
Now slide the bars back to the middle, until the gap to each mark is the same, and tighten.
In the absence of grooves, this analytic geometry solution may work.
If everything is centered, the ends of the handle bars and the front axle will form an isosceles trapezoid.
Begin by verifying that the handle bar is centered in the stem. (having the same end to stem measurement on both sides.)
measure from the end of the handle bar to the axle. repeat on other side. If the measurements differ, it is not right, adjust handlebar position to minimize differences in measurement and repeat.
If you can't get it perfect, don't worry too much, small offsets are compensated for by riders with ease.
There are two items that need to be centered:
Do those two things in that order.
Centering your handlebars on the stem is the easy part. Eyeballing is usually enough. However, if you desire absolute perfection, simply find a point on the handlebars that is easily distinguishable on both sides and measure to the center of the stem (or a stem bolt if they are centered). You want an even measurement on both sides. The point that you choose on the handlebars can be anything so long as it is easily recognizable on both sides.
I'm guessing that what you're really concerned with is getting the stem aligned on the steer tube.
Once you've got the handlebars centered within the stem, center the stem on the steer tube. Again, eyeballing this is usually relatively easy. I usually do it by looking at the bike from the front, holding the front wheel between my knees, lining up the rear wheel perpendicular to my body, and aligning the handlebars perpendicular to the frame.
I have also heard people on this site talk about kicking the frame off to the side and aligning the bars perpendicular to the front wheel. The idea is that what you really want is the handlebars aligned with the front wheel and the frame is a distraction. I have tried this and it didn't work for me. I'm not saying it's a bad approach, I just think it's not the method for me.
If you absolutely need a mathematical method, the isosceles triangle measurements described in Hildred's answer should work magnificently.
You also mention measuring relative to a screw on the hoods. The hoods should be (more or less) the last thing that you align on your cockpit. Go ahead and put the on at the beginning - they'll help you to get an overview - but make centering the handlebars in the stem and the stem on the steer tube your priorities. Once you've got those in place, then it's time to fine tune your hoods. After all, your hoods should be mounted tightly enough to accommodate every day riding but loosely enough that they rotate rather than break if you fall. A pleasant side effect of this is that with a little oomph you can move them into position sans tools of they're close but not quite right.
It's also worth noting that your body is not perfectly symmetrical. No one's is. If you get everything measured out and positioned within a nanometer and it doesn't feel right, readjust it to feel right. A comfortable, easily handled steed is far more important than getting it perfect within a nano meter..
This might be overkill, but...
All that said, most modern bars have some visible demarcations on either side of the clamp area that makes eyeballing and/or measuring to the left and right of the stem pretty easy, without all this silliness.