The city of Tokyo and its surrounding area is one of the biggest, most crowded urban centers in the world. If all those people are going to get around, they had better have an extensive railway system, and Tokyo can certainly oblige.
Tokyo's train system is famous for being: (a) incredibly crowded, (b) incredibly efficient, and (c) incredibly complicated. Part of that complication stems from the fact that there's a whole swathe of private companies that all own their own railway systems. Even the Tokyo Subways have two sets of lines owned by different companies (although they're part of the same system).
Wait, how many companies? A lot. Japan denationalized its railway system in the 1980s (because they were losing money by building bullet trains in odd places). But even before then, there were a lot of independent railway companies all vying to find a bedroom community whose citizens they can shuttle to central Tokyo for their mind-numbing day jobs. And you've also got some tram services still around, as well as a couple of fancy monorails (one of which goes to Haneda Airport).
If you're in the very center of Tokyo, though, for the most part you'll run into the JR lines and the subway lines. The subway lines take you from place to place within town, and the JR lines are part of the national network and go to the far-flung places in Greater Tokyo. But the heart of the network is the Yamanote Line, which is probably the one you'll see most often in works set in Tokyo.
The Yamanote Line? It's a JR line that works like a subway linenote , running in a 29-station loop around central Tokyo. It's elevated all the way around, meaning you can see it just walking down the street, and you can sit on a train and see all the big parts of Tokyo. It's also pretty distinctive with its lime-green signs, indicators, and trains, so you can spot a Yamanote Line train pretty easily.
And it stops at almost all the important stations in Tokyo — Tokyo Station (where all the ridiculously-fast Shinkansen trains are waiting to take you to every corner of Japan), Shinjuku (in the Guinness Book of Records as the single busiest train station anywhere in the world), Shibuya (home of the famous Hachikō statue), Ueno (gateway to northern Japan), Shinagawa, and Ikebukuro.
As such, it's no surprise that it's one of the single busiest commuter railway lines in the world — one estimate has over four million people using the line per day. The images you've seen of the white-gloved train pusher cramming people onto trains like sardines are likely from this line, and some trains have no seats and extra doors just to be able to fit everyone.
In fact, the line is an unofficial limiter for the other railway companies — they'll only take you as far as the Yamanote Line, but they won't go inside it, instead stopping at one of the major termini. The main exception is the subways and the JR Chuo Line, which snakes its way right down the middle of the loop looking for all the world like a Yamanote Line train (but in yellow or orange rather than green). That is, until you factor in the through service.
Wait, "through service"? All right, this is part of what makes the Tokyo railway system so complicated:
The subways mostly operate only in the city center. But many of them,note once they reach the end of the line, will wander on to one of the commuter lines (JR or otherwise) and continue on those lines for a bit, providing direct service for the commuters. A few of these private railways only make sense when you think of them as extensions of a subway line. But these extra services are not part of the subway or maintained by either of the subway companies, so it's up to you to figure out which train is going to get you where you need to go.
This can take subway trains really far out of town. It's entirely possible to accidentally fall asleep on a Tokyo subway train and wake up in Yokohama.
Okay then. So how does it run? Remarkably well. But then, that's to be expected from the Japanese.
The subways started the trend of numbering all the stations — each station has a letter-number indicator, the letter referring to the line and the number referring to the station's place in the sequence. Many of the private railways started doing this, too, but with two letters, the first one indicating which company, the second indicating the line, and the numbers indicating the sequence. This is how you get indicators like "JY-20" for Shibuya — "J" is because it's a JR train, "Y" for the Yamanote line, and "20" for its sequence in the line, so you know it's after "JY-19" (for Harajuku, right under the Harajuku Shrine, another famous Tokyo tourist spot). It's very useful to have these if you can't read Japanese (except almost all the signs are written in English anyway, so it doesn't matter that much in the end).
The trains are incredibly punctual, to the point that if a train leaves a station only a few seconds behind schedule, it can wreak havoc on the timetable for the rest of the route. An unusual aspect of this is that if the train is late, the railway company may give you a certificate to hand to your employer, in case he refuses to believe that your train was really late. Although there's getting to be more and more automation, all trains still have a driver who's gone through a Training from Hell (which often includes knowing, to the decimal, the train's exact speed just from visual references — i.e., without a speedometer).
The people are also basically inoculated to the overcrowding, and in spite of the mass of people, they'll line up as best they can. Most of them kill time reading a newspaper (perhaps that's a reason why half of the top ten highest-circulating newspapers worldwide are Japanese). It helps that you can read them vertically.
But isn't it dangerous to be that crowded? Well, it's better than riding on top of the trains (the "Dhaka solution", as it were). But it does have its share of issues:
The Chikan is one of the more infamous characters of Tokyo's railway system — basically, a guy who gropes women on a crowded train. Since you can't tell who it is in such a crowded train (and the Japanese don't like making a big deal about that sort of thing), they get away with it remarkably easily. The more sinister ones might take surreptitious pictures with their phones as well, including from underneath. It's gotten to the point where you can see rush-hour cars specially designated for women, just to keep them away from these guys.
Disruption on the system can be costly; if one thing breaks down, it can have a knock-on effect throughout the system. This might be one of the most unrealistic bits of certain anime — if the villain knocks out the subway (or, God forbid, the Yamanote Line), they should be grinding all of Tokyo to a halt — not something they can get away with so easily. On a related note, someone who chooses to commit suicide by train on one of Tokyo's railways can expect a bill to be sent to their family, in proportion to the disruption they caused. Japanese railways can rely on second-perfect timing, so anything that throws a monkey wrench into that will be felt for the rest of the day.
But it's still the best way to get around? Oh, for sure — do you want to risk getting stuck in traffic? At least the trains are moving. In a city so crowded, it's not worth it to have a ton of cars on the road. And with the Olympics coming in 2020, the railways are working on even more ways to make things run smoother. The problem is that there's not a lot of room to build anything anymore, to the point that both subway companies have basically given up on building new lines (the Toei Metro's last line, the Oedo Line, was one of the world's most expensive subway lines in terms of construction costs and racked up a ton of debt, and the Tokyo Metro's last line, the Fukutoshin Line, was delayed for 20 years and had so little room to build the tunnel that in some places it fit by centimetersnote ).