Comfortable, flattering and won't run even after a long day of fighting monsters.
So, you have a female character, and you want her to appear prim and proper, while still being feminine and fitting in with all of your other female characters. It would usually (with few exceptions) be improper for her to wear pants, but it would be difficult to have her fit in full dresses when all of your other female characters are wearing short, suggestive skirts.
The solution is simple - have her wear thick, opaque tights with a skirt. The skirt allows her to fit in with her fellow girls, but the tights ensure that she remains proper and well-covered. It retains that feminine quality, yet prevents the lady from in any way seeming risque.
This style of dress is particularly common in Anime with The Ojou and Yamato Nadeshiko. Compare with Skirt over Slacks, which occurs when pants of some description are added to an already modest skirt in order to convey shyness or tomboyishness, and with Modesty Shorts, which ensures modesty for the Action Girl who wears a microskirt. Contrasts with Zettai Ryouiki, which are usually employed to instead enhance the fanservice of the outfit, highlighting innocent, budding sexuality; and with Tights Under Shorts, which incorporates something more boyish than a skirt but is nevertheless used more frequently on girls than on boys.
Note that when it comes to children, and especially school uniforms (except where School Uniforms are the New Black), this is so standard that no examples need to be given.
Namie Yagiri (The Ojou) wears a miniskirt with tights in the anime version of Durarara!!. However, this trope is averted in the original Light Novel, where she wears type A Zettai Ryouiki, as well as in the manga where she's totally bare-legged.
Mikuru Asahina wears this during the winter months in Haruhi Suzumiya (as seen in Disappearance with her school uniform), as does Yuki Nagato in the spinoff series The Disappearance of Nagato Yuki-chan.
Hanayamata: Hana stands out for being outgoing, and she's shorter than her friends. Of the five girls, only she wears tights with school uniform and with her dancing kimono.
Mariya Shidou from Maria†Holic wears black tights with his (yes, his) uniform and portrays himself publicly as one of the nicer girls. However, when he and Kanako are alone together, his sadistic side rears its ugly head.
Mitsuuru Takahashi from Pretty Cure Heavy Metal is a rare male example at times. Sakura Cobain also wears white tights under her school uniform during the colder months (of course, since this is Isuten Junior High we're talking about, the same outfit also includes a black leather jacket, possibly the only way to make tights look any cooler—other than using shorts instead, of course).
Another male example is Haru Nagato, the male maiden from the upcoming Pretty Cure Strange Happenings. Yumi's thigh-high red stockings go so high they barely rise above the lower edge of her uniform's crinoline skirt, leading some to mistake what she's wearing for tights. Also, every Cure that doesn't wear Tights Under Shorts wears this in Cure form, and Cure Necro herself sports Tights UnderModesty Shorts.
Both Meran and Korii in Shining Pretty Cure. The former is a rare male example, and both do this with tunics.
While Ichiban High School enforces this in Futari Wa Pretty Cure Dragon, one of its students, Ryan Lee, is notable as a male example; another student, Susan Chan, also wears this as Cure Fortune. Yet another student averts and defies this trope, instead going for Modesty Shorts.
Samantha (the Victorian Era...oops, The Edwardian Era girl) from the American Girl franchise wears this. She expresses dislike for it, especially as her grandmother insists on her wearing long underwear underneath them from September to June (in an attempt to prevent tuberculosis).
In the first book of The Princess Diaries, Mia's grandmother tries to get her to wear these as part of her princess makeover. It ultimately fails because Mia doesn't like wearing tights and doesn't choose the "right" style.
One of Joan Watson's wardrobe staples in Elementary. Joan is, at the very least, much more proper than her Sherlock, as well as having too much sense to run bare-legged around New York City in cold weather.
Annie Edison from Community , especially in Season 2
Truth in Television; it's pretty much standard clothing for girls and is especially common among schoolgirls (especially those who wear uniforms) and some classes of athletes in Real Life. Although in recent years (with the exception of uniforms) leggings have become more popular, although usually with the same effect.