Insert Song

An Insert Song is a song with lyrics that is inserted during a certain scene of a show or series. Usually, this is done to give a scene more emotional impact by using a song with lyrics which relate to the scene in question. Sometimes though, especially if it's a music-oriented show, the creators will have the characters play a song in-story.

What sets the in-story version apart from a regular Musical Episode is that there has to be something important happening in-story as justification for why someone is singing, and that the entire cast doesn't have to be involved.

This is very common in anime, as detailed in Anime Theme Song, since most voice actors/actresses also happen to be popular singers.

Note that the opening theme only counts an example if it's used in the middle of the show, when something is actually happening. And the ending theme doesn't count as an example if it starts during a scene which segues into the credits.

Compare Anime Theme Song (the opening theme, which can be used as this sometimes), Image Song (can overlap with this if the song in question is brought into the show), Leitmotif (when a particular piece of music is tied to a certain character), and Theme Music Power-Up (when epic BGM is playing while a character is kicking ass).

Anime

 * The Lyrical Nanoha series has several:
 * Take A Shot from Magical Girl Lyrical Nanoha
 * Brave Phoenix from Magical Girl Lyrical Nanoha A's
 * Pray from Magical Girl Lyrical Nanoha Striker S.
 * Haruhi Suzumiya also has a couple:
 * God Knows is used as the concert version of this trope, along with Lost my music...
 * Being a show about girls forming a music club, K-On! has quite a few, such as Fuwa Fuwa Time.
 * Digimon Xros Wars has this, this, and this.

Film

 * Sucker Punch had several, such as this.

Visual Novels

 * Kira Kira, being a VN about forming a rock band, has gems such as Let's Jump, Kimi no Motoe, and a rock version of their school theme, O. H. B. I., all of them performed during their concerts.

Western Animation

 * Phineas and Ferb has several, considering that the entire series runs on Musical Episodes.
 * The Fairly OddParents also has a number of them, such as My Shiny Teeth And Me.