The expression “to a T,” as in “That suits you to a T!” is often mistakenly written or said as “to the T” (or “to a tee” or “to the tee”). This type of alteration occurs often in idiomatic phrases (note “all of the sudden” and “for all intensive purposes,” among others). In today’s anarchic publishing environment, writers are free to consciously or unconsciously style such phrases however they choose, but careful writers will preserve prevailing norms.
But what, exactly, is a “T”? None of the various proposed origins of “to a T” is definitive, but only one makes any sense. The opinion that it refers to how well a T-shirt fits is nonsensical: The term for a collarless, short-sleeved shirt is less than a hundred years old, and the expression dates to the late 1600s.
That also disqualifies the more plausible theory that it alludes to the precision a T square, the T-shaped drafting tool, enables; the first attested use in print of the tool’s name postdates the first use of the phrase by nearly a century. And is has nothing to do with the golf implement known as the tee, which has always been spelled as such (though the spelling error “to a tee” goes back hundreds of years).
Most likely, the phrase is descended from the expression “to a tittle.” A tittle is a small mark used in orthographic details, such as the dot over an i or a j or a diacritical mark such as an accent mark, and the sense is “to the smallest detail.”
But why isn’t the expression styled “to a t”? That’s because uppercase letters are the default setting when using a letter to represent something. Report cards have As and Bs (but, the recipient hopes, no other capital letters), the force of gravity is expressed as a multiple of Gs (the capital letter is the scientific symbol for gravity), and X, not x, marks the spot. (We also use uppercase letters such as S and V to denote shapes—though, like X as a location marker and the other uses referred to above, they should not be italicized in those contexts, because they do not literally represent letters.)
There are a couple of exceptions: The context of “Dot your i’s and cross your t’s” and “Mind your p’s and q’s”—if one accepts the contested interpretation that the latter originally referred to easily confused letters—requires lowercase letters.
Does teetotaler have any connection? The word for someone who abstains from alcohol goes back nearly two centuries but originally referred merely to intensification of one’s feelings about being totally devoted to something, with tee attached as a form of reduplication. But as the differing spelling indicates, this word has nothing in common with the expression “to a T.”