Examples of type 1 (characters involved in production)
Max Havelaar has fun with this trope. The main story, of which Havelaar is the protagonist, is presented as a book written by the character Stern, based on essays written by "Sjaalman" ("Shawl Guy") who is heavily implied to be the same character as Havelaar... Oh, and there's a second Show Within a Show, the love story of Saïdjah and Adinda, which is also written by Stern. And did we mention that at the end of the book, the author himself takes the stage and shoos his characters away to deliver an Author Filibuster, thus essentially making Stern's story a Show Within a Show as well, and Havelaar's a Show Within A Show Within A Show?
The Rolling Stones by Robert A. Heinlein. Roger Stone's primary source of income is writing a space opera television serial. The rest of the family "helps" with brainstorming plotlines. At one point, Roger turns over writing duties to grandma Hazel and youngest son Lowell.
Half of Peter Pays Tribute is this. The main character is writing a novel, and that novel is half wish fulfillment, half allegory for his own troubled existence.
In Matthew Dicks's Something is Missing, the protagonist, a career burglar who finds himself moved to help his victims after helping himself to their possessions, begins writing a novel about a character with a similar vocation to his own. (If Dicks himself were such a burglar, the recursion would have been perfect.)
In Rodrigo y el libro sin final (Rodrigo and the unfinished book), the titular character, a nine-year-old boy, helps a novelist suffering from writer's block to find an ending for a book he borrowed from the library. This is also an example of Types Three (because the story revolves around this) Four, because some events in that book (which tells the story of a pirate who reaches old age) can be put in parallel with the writer's own life.
There are several in the Discworld series: Moving Pictures has a large number of snippets/scenes from the "clicks" (movies) being produced, most of which parody either specific films or film genres; Wyrd Sisters features a Macbeth-like play and a Macbeth-like plot, also mixing in various Shakespeare tropes; Maskerade does much the same with Phantom of the Opera; and The Fifth Elephant frequently alludes to an opera about the semi-mythical founders of the dwarven kingdoms.
Tanya Huff's Smoke series involves mostly characters involved in the production of Darkest Night, a show about a vampire private detective. Considering that the protagonist of the novel has an ex who's a vampire, this leads to some interesting situations.
Jeff Vandermeer's Shriek: An Afterword and City of Saints and Madmen}} both put a huge amount of emphasis on these; appropriate given that many of the characters are academics, artists and the like. Shriek itself is an afterword to a short guide to the early history of Ambergris featured in City of Saints. City of Saints is made up entirely of various shows-within-a-show. Some of them are fake.
"A Story by John V. Marsch" the second story in The Fifth Head of Cerberus by Gene Wolfe is written by a character who appears in the other two. This just adds to the Mind Screw off the book.
Because Earth's music is so awesome, the rest of the universe in Year Zero tends to emulate our other art forms (despite the fact we are so bad at everything else). Thus Sonny and His Sirelings, a (highly scripted) Reality Show based in part on The Osbournes, is the highest rated program in the universe.
The plot of Heart In Hand is set in motion by the reality show following the lives of Darryl and Alex. Later on, it changes its format to focus entirely on Alex and the aftermath of him coming out of the closet.
The main character of Rosemary Edghill's The Warslayer is the lead actress of a Buffy/Xena-style fantasy series; the book includes an episode guide to the series, including fannish commentary and backstage anecdotes.
In the Robert Rankin novel Sex and Drugs and Sausage Rolls, Poole and Omalley put on a show based on the novel Armageddon: The Musical by, er, Robert Rankin.
Each of the first three Dream Park novels alternates between a live-action Game with its own plotline and characters, and an investigation storyline that unfolds behind the scenes. The fourth novel starts out that way, until the behind-the-scenes plot crashes into and disrupts the Game's course.
A Song of Ice and Fire has a Braavosi play "The Bloody Hand", which is based on recent events in the series. It turns Tyrion Lannister into a scheming villain who murders his nephew (which is the official version of what happened), basically being a take on the notorious Historical Villain Upgrade in "Richard III".
Vladimir Nabokov had two major examples: his 1938 Russian novel The Gift is about a young writer trying to make a name for himself, and in chapter three, the writer decides to write a biography of the 19th century writer and activist Nikolay Chernyshevsky. Chapter four consists of that biography in full (for which Nabokov did a ton of original research.) His 1962 novel Pale Fire purports to be a critical edition of a fictional poem of that title, by fictional poet John Shade, along with a critical commentary by the editor Charles Kinbote, supposedly a close friend of the poet; all is not as it seems, though.
La Brèche is about a fictional American Reality TV show from the 2060, named You Were There, consisting in shooting the past with the help of Time Travel. The novel focuses on the latest issue: the Allied landing on Omaha Beach. While most of the story is about the two persons sent in the past (a war reporter and a World War Two historian), the story also has parts about the making of the show itself. The time travellers unintetionally cause a time paradox on the beach, which nearly results in Germany winning the war and controlling the world. After they return, the show is cancelled.
Examples of type 2 (characters are fans)
The story of Kelly Link's award-winning novella, Magic For Beginners, describes one episode of an unnamed (presumably) television series about an ordinary boy named Jeremy Mars and his circle of friends, who are obsessively devoted to a pirate-television fantasy series called The Library. This show-within-a-show is broadcast irregularly on the otherwise "snowy" channels. Each episode is portrayed by different, non-credited actors and features advertisements for non-existent products. Much of the plot involves the actions and resulting interactions between the two shows.
As a child, Miles Vorkosigan was a big fan of a holovid action/drama serial about Lord Vorthalia the Bold, Legendary Hero from the Time of Isolation. As an adult, he can remember most of the 9 verses of the theme song. It's likely that he picked up some of his Knight Errant tendencies from this.
Avoiding type 1, a Marilacan production company attempted to hire Admiral Naismith as an consultant for a holovid docudrama about the Dagoola IV breakout. For security reasons, Miles declined to participate.
Nikolai Vorsoisson is fond of holovids featuring Captain Vortalon, a jump pilot who has galactic adventures with Prince Xav, smuggling arms to the Resistance during the Cetagandan invasion.
Beta Colony produced a film based on the Escobaran War and Cordelia Naismith's role in it called The Thin Blue Line. Their portrayal of Prince Serg upsets Elena Bothari, because most Barrayarans view Prince Serg as a hero, not as a Caligula.
Don Quixote: "The Ill-Advised Curiosity" is a true independent novel within the novel of Don Quixote, and the curate found it in the Inn and reads it to all the guests completely through two entire chapters of the first part.
Played with in the Torchwood novel Border Princes. Throughout the novel, frequent mention is made of the band Torn Curtain, the animated series Andy Pinkus, Rhamphorhynchus and the science fiction drama Eternity Base. It turns out this is all created by a subconcious Reality Warper, evidenced when Gwen leaves Cardiff, and suddenly a magazine article about Glenn Robbins of Eternity Base becomes about Jolene Blaylock and Star Trek: Enterprise.
In The Girls Series by Jacqueline Wilson, the book Girls in Tears features a subplot about Nadine becoming a fan of a fantasy TV show called Xanadu, an obvious pastiche of Buffy the Vampire Slayer and Xena: Warrior Princess. It features near the ending of the story when Nadine goes off alone to meet her internet boyfriend whom she got talking to on a fanboard for the show, forcing Ellie and Magda to repair their friendship to go after her. Unsurprisingly, the guy turns out to be a Dirty Old Man who's not quite as young as he told Nadine.
All three Dream Park novels take place during complex live-action adventure games, which a park security man must join to conduct a murder investigation. Successfully playing out the game in-character is necessary to solve the mystery, and each game's outcome is impacted by the investigators' and perpetrators' hidden agenda.
Laurence Sterne's novel The Life and Opinions of Tristram Shandy, Gentleman is the eponymous character trying to relate his life story to the reader. However, he is rather poor at explaining things, and thus ends up on a tangent so frequently - the net result of this running joke being that there's very little of Shandy's own life in it. In a nine-volume set published over ten years, we finally reach his birth in the third.
This formed the central joke in A Cock And Bull Story, which is about the making of a film adaptation of the novel (widely considered unfilmable), thereby becoming a recursive instance of this trope — a film-within-a-film whose subject is a book-within-a-book.
The Jack O'Connell novel The Resurrectionist features a comic book series about a carnival freak show in fantasy Central Europe called "Limbo." "Limbo" is a multimedia franchise in the book's world, and the hero's comatose son was fascinated by it. The word is also an arc word outside of the comic.
In the Roald Dahl story "The Wonderful Story of Henry Sugar", the title character discovers a Fictional Document which is an account of a doctor in British India and how he encountered a man with real yogi powers: said document is quoted in full, as a story-within-a-story. Furthermore, the document itself includes the complete life story of the yogi himself, making that a story-within-a-story-within-a-story.
The title character of Ack Ack Macaque is also the central character of a very popular MMPORG set in a Diesel Punk version of WWII.
Sophie's World has a bit of a twist: The majority of the book is the show within the show. The novel doesn't diverge from the in-universe version of itself until Sophie escapes into the "real" world.
In the web series Relativity, there is a comic book based on the exploits of the original Black Torrent. Reading the comic helps inspire Michael to become the new Black Torrent.
At one point in The Dragon Hoard, the heroes are captured by a sorcerer who demands they tell him a story or being killed and eaten. The story they tell is quoted in full.
In Thud!, it's a plot point that Vimes reads book-within-a-book Where's My Cow, a kiddie primer on animals and the sounds they make, to his son at precisely six o'clock. Specifically, when he's separated from his son by plot events, he starts yelling out the words in an attempt to let Sam Jr. hear them. While fighting underground. THAT! IS! NOT! MY! COW!!!
In the Drake Maijstral series, Drake's own exploits (like those of most of the top allowed burglars) are the basis of a loosely fictionalized and very popular show. Drake himself doesn't watch the show, which offends the young star who plays him when they finally meet.
The Passion Play in the novel Christ Recrucified, by Nikos Kazantzakis, reflects the fate of all characters who take part in it.
A major plot point in VALIS. Kevin convinces his friends Horselover Fat and Philip K. Dick to go watch a movie named Valis, and the three of them realize that the events in the film parallel the bizarre visions that Fat has been having. Before, they had been able to dismiss these visions as hallucinations, but seeing the film convinces them that someone really was contacting Fat, and this same someone had also contacted the filmmaker.
The Star Trek Expanded Universe has "Battlecruiser Vengeance", a Klingon space opera featuring the adventures of a Klingon starship captain and crew.
In the Diogenes Club short story "Soho Golem", Fred Regent finds a paperback in an adult bookshop called Confessions of a Psychic Investigator, in which the main characters are strangely similar to Richard Jeperson and himself, only adjusted for an Awful British Sex Comedy. Flicking through it, he's a bit annoyed that "Robert Jasperson" gets all the action, while "Bert Royal" spends his time peering through keyholes.
In Dahl's Charlie and the Chocolate Factory, the Oompa-Loompa song that follows on from Violet's gum-chewing-based undoing is primarily the Greek Chorus recounting the sad, cautionary tale of one Miss Bigelow. She had a similar habit and wound up biting her tongue in two and going mad, and the Oompa-Loompas promise that they will try to ensure Violet won't go down a similar path. (Adaptations usually drop this bit.) In the sequel Charlie and the Great Glass Elevator, they recount a similar story involving a little girl and powerful laxatives in the wake of the grandparents (aside from Joe) taking too much of a Fountain of Youth pill.
About half of The Ghost Writer is filled with them. However, only one of them is the mostly connected with the life of the protagonist and his mother, Gerard and Phyllis, respectively, the story that simply titled as "The Ghost".
The Reader 2016 has the exploits of Captain Reed and his crew that Sefia reads about in the book, until she finds out that they're all real and she's been reading their history.