Much of this is determined by the font file itself. Some fonts have extra leading built in which can cause odd vertical alignments.
If you find you've got a font with the odd leading, you can select the text and apply
Effect > Path > Outline Object. Then in the Preferences ensure
Use Preview Bounds is checked and vertically align things. This will use the visual areas to align, often resulting in better alignment without the need to outline the type.
After doing this you can remove the effect and revert the preference setting if desired.
(All these images are aligned on horizontal centers and vertical centers. The rectangle is a separate object and all type is "live" type.)