To be a first line of defense against pit stains and other visible traces of sweating through my shirt.
I've been rocking the white Hanes v-neck tagless numbers for a long time. Put me in the camp that with button-down dress shirts, you should not see a collar or any other hint of an undershirt.
I feel that way about polos, but really not religious about it, and if I'm going for a look where I want to show some tee under my button-down/polo, I'll wear a matching or complimentary-colored tshirt.
I normally hold on to these far longer than I should, so they become dishevelled yellow dishrag-looking things after many years of use, but hey, no one sees them so as long as they don't smell, I'll wear them until they are threads. Should probably update that behavior.
I'll also say another purpose of an undershirt is insulation. This has never been my problem as I've been mostly overweight my entire post-college life, and have always run hot in terms of my body temp. This past year I lost a bunch of weight and now I'm freezing in climes where I've been sweating, so not only have I moved to long-sleeved thermal tees in cases where I don't care if a little undershirt collar shows, I've also taken to wearing long thermal underwear under jeans and even under dress pants on one or two occasions in colder weather (I don't suggest this as depending on the material of the dress pants, they may hang differently with long-johns).
I've moved to a whole layering system, often rocking what I call a "4-2-2" (4 layers on top -- thermal long sleeve, t-shirt, casual button down -- 2 on the legs -- thermal long johns and jeans -- and two on the feet -- cotton ankle socks with thermal socks over top).
Yes, I am a complete freak.