"Right smack dab in the middle of town I've found a pa-ra-dise that's trouble proof... And if this world starts getting you down There's room enough for two Up on the roof..."
—The Drifters, "Up on the Roof"
With the usual size of homes in Japan, sometimes the only option available to a character who desperately needs to be alone is to climb up and sit on the roof of their house. There they can look up at the night sky and contemplate their place in the universe in peace and quiet.
Naturally, everybody and their dog will promptly climb up there after them.
Related is the fact that the standard Japanese high school design includes an accessible roof, which is seldom locked in any serious way. Access to the roof is almost always explicitly forbidden, but that doesn't seem to stop anyone. Students and faculty will often find their way up to the roof for private lunches, heart-to-hearts, romantic goings-on, secret supernatural battles, or suicide. It has a chain-link fence to keep people from jumping off, except of course for all the people that do.
Often when appearing in western stories, it's to show how the character is a Cloud Cuckoo Lander or a free spirited dreamer.
This is often used in modern-day urban settings (even spreading to western productions) because it allows for a panoramic view of the character and the skyline without having to travel out of town — which explains why it seldom appears in non-urban settings. It also happens often in Western medical dramas, for the simple reason that the rooftop is usually the most quiet place in a hospital...unless it's near the helicopter pad.
Compare (and sometimes overlap) with I Have the High Ground and Watching the Sunset.
Practically every single anime that comes within 100 mi of a school.
Ranma from Ranma ½. This is aided by the fact that he can leap up there from the ground. (See image above.) Many scenes also feature various characters up on the school's roof. This is anime only; in the manga Ranma sits in trees far away from the Dojo to get privacy but does use the roof as a meeting place.
Noa and Asuma frequently relax and share quiet moments on the police HQ's roof in Patlabor.
Most of the characters spend some time up there at some point. This gets them in trouble at one point, when a media helicopter gets pictures of most of Division 2 hanging out on the roof and runs a story about government waste.
One of the stock sets in Great Teacher Onizuka is the school roof. A third of their time is in class, another third on the roof and the remainder is everywhere else.
Bleach: Ichigo and his schoolmates are frequently seen on the school roof, whether eating lunch or just being dramatic.
Some of the shinigami are very fond of doing this, especially Aizen (pre-villain reveal), Hinamori, Hitsugaya, Matsumoto, Kenpachi and Ikkaku.
The school roof is used a lot in Kamichu!. Yurie and her friends go on the roof to learn what powers Yurie has, Kenji conducts club meetings on the roof, and Yurie later goes on the roof to sob in peace.
Several of the girls go on the roof in Azumanga Daioh to eat their lunch. Once,when they were up there, three fell asleep.
Variant: In Hand Maid May, the ladder between their apartments serves as the private place for Kazuya Saotome and Kasumi Tani. But since it becomes practically an expressway in the anime, they head for the traditional roof escape later.
Kyo in Fruits Basket spends a lot of time sulking on the roof of both Shigure's house and the school. Most times he does this, it's so that Tohru can follow him and give him a pep talk.
Yu-Gi-Oh! GX: Judai spends a good deal of time on the roof of Duel Academia talking to monster spirits.
Yugi from the first show has done this as well. LittleKuriboh even based a joke around this; he's been locked up there again.
The launching point for The Twelve Kingdoms, which starts off in a typical anime high school setting and leaves it more or less permanently after the opening scenes. Youka Nakajima and the Kirin Keikei meet in a classroom and head for the roof, not for the usual reasons, but because they are under attack by monsters powerful enough to kill every student and teacher in the building. Two other students, Asano and Yuka, are on the roof for a more typical social rendezvous and are swept up in the adventure.
In School Days, Sekai, Makoto and Katsura often eat lunch on the roof. In the ending, Kotonoha lures Sekai to the roof with an email from Makoto's cell phone and kills her.
In Otomen, Ryo, Asuka and Juta eat lunch on the roof so that other students won't know about Asuka's amazing bento making skills.
Setsuna from Shattered Angels likes to use the roof as a vantage point to observe, and for looking cool.
Shana from Shakugan no Shana does this after her first day in Yuji's world, waiting for Friagne to return so that she can fight him again.
In Hidamari Sketch, Miyako does it on the Hidamari Apartments' roof, usually with stray cats. Yuno, on the other hand, does this on the roof of Yamabuki High School, but for a different reason...
Train from Black Cat did this a lot, especially in the anime. Probably to try to show his similarities to cats.
In Monochrome Factor it's Akira and Kengo's favorite spot for avoiding classes and discussing the current situation.
In Tactics Haruka frequently broods on the roof; it helps that he's a tengu and therefore can simply fly up there.
Gunslinger Girl. Triela is seen doing this while moping over her defeat by Pinochio. Those Two Guys from the Agency see her; one remarks that they better get her down as her handler will be furious is he sees here up there. His partner notes, "I think that's what she wants."
Played for laughs in The Day of Revolution: Nakagawa insists on taking Megumi hostage in order to gain sole possession of the roof (and the implied Big Man on Campus status that comes with it) even though her True Companions are perfectly willing to share. Ironically when Makoto goes to the roof to report the kidnapping no one is there.
Done for the wrong reasons in Digimon Savers, as Masaru moves Agumon up onto the roof in order to keep his mom from discovering him after Agumon tumbles out of his closet.
In Special A, Kei retreats to the roof of Hikari's house when dealing with a crazy and ill Hikari was unbearable.
Renamon from Digimon Tamers can frequently be found spending her downtime sitting on the roof of her tamer's house.
Mutsumi Saburo of Keroro Gunsou is commonly shown hanging out on the rooftop; it's also a favored hangout for ninjas Dororo and Koyuki.
The eponymous Niea from Niea_7 does this a lot, often while listening to her blues records. Mayuko also does this frequently, mostly while discussing things with her best friend Chiaki.
A key Death Note scene has Light finding a distracted, uncharacteristically chatty L brooding on the roof of the headquarters building.
In Kekkaishi, the main character often goes to the roof during lunchtime to contemplate the latest problem to crop up, often with another character beside him to comment.
He also goes up there to get his much-needed sleep, cutting class (he puts a shikigami in his place) in the process.
In The Fast and the Furious: Tokyo Drift, one of the Yakuza guys pulls in the school's rooftop a dramatic fight against the Black guy who sold him a defective iPod, luring an entire mob of students up there.
Will Stronghold and Layla from Sky High sit on the roof for a talk.
Two out of three High School Musical movies have Troy and Gabriella getting some alone time on the roof, even singing up there in the third movie and The Musical.
In Chicken Run, Ginger goes up to the roof of her hut frequently to look out at the hills beyond the fence and imagine what it might be like to live there. Later on, she runs into Rocky there. "I'm sorry, is this your roof?"
Numerous scenes in The Room feature the boys relaxing on the roof of the apartment building. Of course, they also play football and apprehend a drug dealer up there.
A Westernized version in A Tree Grows in Brooklyn, Francie reads on the fire escape every Saturday afternoon, when weather permits. Since they live on the top floor of their third home, they also have dibs on the roof.
Spider Robinson is fond of this trope, and in his Callahan series the bar even has a beautiful iron circular staircase leading to the roof. Before the staircase was installed, patrons rode up in a large dumbwaiter.
In the first graphic novel published in the Warrior Cats series, there's a scene where Graystripe and Millie have a heart-to-heart conversation on a random roof. It kind of makes sense because they're cats. This image was even colored and used in promotional materials.
In G. K. Chesterton's Manalive, one of the first eccentric stunts pulled by the Blithe Spirit main character is to climb up on the roof of the boarding house he's staying in. Two of the other characters follow him up and realize that they're enjoying themselves for the first time in years.
In A Little Princess, one of the only things Sara likes about her Fallen Princess circumstances is that her attic room has a skylight, and she can stand up through it to people-watch and see the sunset. It's because the roofs are connected that she meets the Indian servant next door one day, which leads to her being discovered and rescued.
Vin does this a few times in the Mistborn trilogy, notably after an argument with the rest of the crew.
Max of Dark Angel liked to sit on top of the Space Needle.
Harry in 3rd Rock from the Sun. Later, make that the whole team. Before long, it became a Once an Episode, where the aliens discussed what they learned, usually putting some comic spin on it. Of course, just because this is how every episode ends, it didn't prevent the characters spending time on the roof throughout the episode either.
The kids in Misfits hang out on the roof of the community center, where they have furniture set up.
In the Hannah Montana episode "Me and Mr Jonas and Mr Jonas and Mr Jonas", Miley ends up sitting on the roof after being caught out during her latest Crazy Scheme. Given that the "roof" is two feet off the deck it loses some of its impact once the wide-shot is established.
Happens frequently in Scrubs. Usually Ted's the one with the suicide variant, while Kelso's up there to egg him on.
Futhermore for one episode the 'Epiphany Toilet' is located on the roof
In an episode of SVU, Phin notes that in lower-income households, the roofs of apartment buildings are popular places for teenage couples to go for private "conversations". They're also choice spots for junkies to shoot up in peace, which is how they find their suspect dead of an overdose.
Simon from The Inbetweeners climbs onto his garden shed to gaze at the sky when he is caught modelling by his parents.
Horribly subverted in the series 2 finale of BBC's Sherlock, when the titular character stands on the roof of a hospital and does some deep thinking and comes to some important conclusions about himself—though he's not the sort of man to have a "happy place", exactly—and then is forced by the villain to commit suicide by leaping off.And then he actually survives the multi-story fall. All the fans are going mad wondering how he pulled it off.
Jeremy often does this in Zits (And his reason for being there isn't because his house is small (It's actually very big.), It's because Jeremy is a teenager.).
"WHY AM I HERE?!"
"Because you climbed up there, you moron!"
Also note that falling off of said roof makes one an excellent candidate for a Darwin Award.
Jeremy also likes to sleep on the roof. Once in the middle of winter. Another in Summer. Note he has a habit of sleeping in the nude when the temperature gets too hot. Now THAT caused quite a traffic jam in front of his house that morning.
Calvin from Calvin and Hobbes occasionally ends up on the roof, but this is generally because he's hiding from something.
In one comic, Calvin hides on the roof while his mom tries to find him to make him take a bath.
In another comic, Calvin's bike attacks Calvin inside the house, so he climbs out a second-floor window and closes it behind him. Calvin then realizes that his parents will blame him for the bike tracks in the house, so he resigns himself to staying on the roof for a long time: "One of these days, the neighbors will look out the window and wonder why there's a grown man in six-year-old's clothes on our roof."
Snoopy from Peanuts often sleeps on the roof of his doghouse, not to mention pretends to be the Red Baron, among other antics.
In the musical Fiddler on the Roof, the musical's title stems from a painting by Marc Chagall, one of many surreal paintings he created of Eastern European Jewish life, often including a fiddler. The Fiddler is a metaphor for survival, through tradition and joyfulness, in a life of uncertainty and imbalance. The main character explains that the lot of the Jews in Russia is as precarious as a fiddler on a roof: trying to eke out a pleasant tune while not breaking their necks.
Yuuichi goes up on the roof to talk to Mishio in Kanon.
In Persona 3, the roof of Gekkoukan High School plays host to numerous events within the game, both plot-driven and optional (in certain Social Links). Pretty much all of these involve some sort of personal heart-to-heart conversation. Also, you can actually access the roof yourself in the normal course of the game, although nothing happens if you do.
There's also a sidequest to water the dying flowers up there, but it's the most trivial side-quest in the game... unless you interpret it as Elizabeth taking an excuse to give you an extra reward, since by this time it's obvious that she's falling for you. That the reward is a sexy outfit for a different female character doesn't seem to make a lot of sense, but hey, it's Elizabeth...
Persona 4 also uses this; it's where you can eat lunch with your friends, help out a few NPCs in Sidequests, and interact with Social Links — including preventing a threatened suicide attempt in one SL.
Near the beginning of Assassin's Creed II, Ezio and Federico have a race to reach the top of a church steeple. After Ezio wins, the two brothers joke around before commenting that they "lead a good life" and sitting down, staring up at the night sky while the game's title appears.
Assassin's Creed: Brotherhood also has its titles appearing while two characters stand on a roof, although this time it's Ezio and Mario deciding what to do with the Apple of Eden.
The opening cutscene of Mega Man 2 has the camera ascending up the side of a building to reveal the title character hanging out on the roof.
The characters in ef: A Tale Of Memories spend a lot of their time on the roofs of their high school and the local church.
Shiraki Aeka from Yume Miru Kusuri manages to hit private lunches, heart-to-hearts, romantic goings-on, and (attempted) suicide. The only thing missing is a secret supernatural battle, and I think Antoinette pissing and shitting herself is close enough to qualify.
In Star Fox Assault, the cutscene following the completion of the Fichina level has Fox sitting on the roof of the climate control center.
Katawa Shoujo has a rooftop lunchtime scene between Hisao, Emi, and Rin. You also end up hanging out on the roof with Shizune and Misha at the end of Shizune's route in Act 1. In addition, if you haven't gotten onto any girl's path by the day of the festival, Hisao winds up drinking with Kenji on the roof, which leads to him falling off and dying.
The "access is almost always explicitly forbidden" gets touched upon, as in the previously mentioned bad ending, Hisao goes by a sign telling him to keep off, and in Emi's route, Misha, translating for Shizune, points out that it's against the rules (although the two often eat or talk on the roof with Hisao in Shizune's route).
One illustration for Ganbare Goemon's Great Adventure has the eponymous Goemon doing this on a pagoda.
In MOTHER, Loid hides in a trash can on top of a school roof to avoid bullies. Ninten befriends him by going up there and giving him a bottle rocket.
One of the few emotional scenes in the game Cry of Fear has the protagonist, Simon, finding his friend Sophie on the roof of a random building. The scene starts with Simon, obviously confused, but continues onto being a rather heartwarming scene with the two of them sitting on the edge looking out over the city. That is, until Sophie tells Simon she likes him, but doesn't love him back, where-on she promptlycommits suicide by jumping off the ledge.
Another western example is from Daria. It was a plot point in "Daria!" (A.K.A. The Daria Musical):
Daria: Hey, look at what the newspaper is saying.
Daria: It says a great big storm is on the way.
Daria: The roof's not really where we should be staying.
Daria: 'Cause this big-ass storm is happening today.
In the second episode of Teen Titans, and several afterward, Robin and Starfire have a heart-to-heart on the roof.
Hey Arnold! often have Arnold climbing up onto the roof (as well as other characters) of the boarding house on various occasions, both for thinking, when sad, for being happy as well as going there in his dreams.
On Recess, Spinelli went up to sit on the roof of the school in "Parents Night" after being embarassed by her parents in front of her friends.
Wendy sometimes hangs out on the roof of the Mystery Shack in Gravity Falls, highlighting her Cool Big Sis nature at one point by taking Mabel and Dipper up to show them.
While this can be (and often is) Truth in Television, the temperature on many roofs can easily exceed 140 degrees fahrenheit/60 degrees celsius depending upon slope, material and exposure—not to mention the inherent fall hazard. So please exercise appropriate care and caution before attempting this in real life.