Question #1: Why do many characters tend to have crazy hair colors? What is the cultural origin of such a style?
The origin of this practice is the primarily black and white medium of manga.
Manga pages are printed in black and white, so almost all of the art that mangaka (manga artists) draw is black and white (this is much cheaper for the publishers than if they had to print all the pages in color). Only series that are popular get a precious 1, 2, or 3-page color spread in the manga magazine from time to time or get the full-color magazine cover (virtually no series get a color illustration in every single issue).
Because the mangaka had so few opportunities to draw their characters in full color, they were "starved" for color. In the 1970s, they experimented with using all the possible colors in their infrequent color illustrations. On the other hand, for series that ran on and on for decades, mangaka were likely to experiment with colors in order to make their colored-page spreads of the same characters again and again fresh and differentiated (probably for their own entertainment as artists, as well as for the entertainment of their readers). A single character would be drawn one month with blonde hair, in another month with pink hair, in another month with blue hair, etc.
This was never intended to depict the character's hair color in canon. Rather, the mangaka trusted the intelligence of the readers to recognize the character without the hair color needing to match from illustration to illustration, based on the character's consistent hair style, face, body shape, and/or clothing (in the same way, mangaka have felt free to alternate their screen tone patterns on a single outfit within a chapter, without worrying that a different pattern from frame to frame will cause the readers to not be able to recognize that the same character is wearing the same dress).
As an example, here you can see Kitajima Maya of Glass no Kamen with 2 different hair colors (pink and black) within a single illustration:
The readers were expected to understand that the character's canon hair color was 1) the hair color used most frequently, 2) the hair color used in the first chapters, and/or 3) the hair color mentioned in the dialogue. The readers of such series never assumed that characters drawn with green or purple hair actually had green or purple hair. This is a uniquely creative part of Japanese manga culture. (An exception, of course, is non-human characters who were magic fairies, alien races, or otherwise perfectly likely to have non-human hair colors.)
However, over time, mangaka and readers became accustomed to seeing a rainbow of hair colors in these non-canon color page spreads, and mangaka realized that rather that limiting these colors to non-canon illustrations, they could actually assign such a non-realistic color as a canon character design.
Thus, to identify a character by their hair color is a newer phase in the history of the medium. In contrast to SingerOfTheFall, Hakase, and Blue's claims that the reason characters tend to have crazy hair colors is to be cool, unique, paid more attention to, and easier to remember/differentiate, "crazy" colors were not invented in order to distinguish characters from each other. They originated without any intention of differentiating characters by hair color.
Only afterwards, as a result of the "crazy" colors becoming viewed as possible canon colors, artists have reduced the more historical practice of alternating hair colors for a single character from one illustration to the next.
Glass no Kamen (ガラスの仮面, a.k.a. Glass Mask), which has been running straight from 1976 to the present, is a prime example of the historical practice of mixing up hair colors in a single character from one illustration to the next.
The canon hair colors seem to be: Kitajima Maya: reddish-brown, Himekawa Ayumi: blonde, Hayami Masumi: light purple.
Maya, Ayumi, and Masumi illustrated with every hair color under the sun, not intended to be interpreted by the readers as their actual hair colors:
However, because the mangaka Miuchi Suzue used so many different hair colors for the color-page spreads over a 40-year period, many readers were not sure of which hair colors were canon. As a result, each of the anime adaptions used different hair colors in attempts to match Miuchi-sensei's intended canon colors. Despite the differing hair colors, no one was ever confused about who was who, in either the manga or in the anime incarnations. In other words, hair colors have never been how fans distinguished the characters from one another.
1984 TV anime: Maya (light brown), Ayumi (blonde), Masumi (blonde):
1998 OAV anime: Maya (dark brown), Ayumi (pale brown), Masumi (black):
2005 TV anime: Maya (light brown), Ayumi (dark blonde), Masumi (brown):
2013 Glass no Kamen desu ga parody TV anime: Maya (black), Ayumi (light blonde), Masumi (light brown):
2016 3-nen D-gumi Glass no Kamen parody TV anime: Maya (pink), Ayumi (blonde-orange), Masumi (lavender):
The same historical practice is found in shounen manga.
An example is Takahashi Rumiko's Ranma ½ dating from 1987–1996. Canon hair colors: male Ranma: black, female Ranma: red.
Male and female Ranma illustrated with alternate hair colors, not intended to be interpreted by the readers as their actual hair colors:
Question #2: They also tend to be spikier, another trait not seen in real life. Did the growing trend of Japanese teenagers spiking their hair in a similar style originate from this?
Japanese young people do not spike their hair as a result of manga/anime character designs. As I have explained here, the average Japanese person does not respect or pay attention to these art forms and those who are involved in subculture are generally viewed negatively by the general populace. Shoujo manga is published in manga magazines which regularly advertise hair accessories and offer hair styling advice; the hair styles of the characters reflect fashion trends rather than set them.
Spiky hair is a common character design in anime and manga (though there are many series in which this is not featured). Although I do not have data on the origin of this practice, my guess is that it is derived from real life. Today's Japanese are primarily descended from the Yamato ethnicity but many also include roots from other ethnicities native to Japan (such as Emishi, Hayato, Kumaso, Ainu, Ryukyuan, etc.). I am half-white, half-Japanese and was born with hair texture from my English/Scottish roots, whereas my mother has the standard coarser, thicker Japanese hair. In my observation, when styled, Japanese hair is more prone to hold its shape for longer periods of time than that of some other ethnicities (my hair cannot hold curls, even with copious amounts of styling products. Though even amongst white ethnicities, some people wake up with spiky "bed head"). My understanding is that Japanese hair styles are optimized for the features of their hair texture, as this is practical for individuals' daily routines and for stylists. Producing small, soft spikes like those in the linked photo you provided are simply an extension of working with textures which are naturally conducive to sculpting.
Two more hair styles in manga and anime that may at first strike a non-Japanese viewer as unrealistic are 1) horizonally-protruding wisps of hair in front of the ears and 2) stray strands of hair that defy gravity by curving upward from the top of the head into the air. I had assumed these were not realistic natural formations for hair, and was very surprised to look in the mirror one day and see my hair doing exactly each of them.
Clarification: Hair Color and Style as Symbol
Dimitri mx's answer to this question notes that hair color can be utilized in symbolism, which is true. According to this website,
Mink has long pink hair and violet eyes. A number of anime idols have had pink hair also, such as Youko from "Idol Tenshi Youkoso Youko", Shiratori Nagisa from "CHOU! Kuseninarisou", and Aida Sachiko from "Debut". In Japan the color pink implies youth and innocence - the youngest, cutest, most childish idols are often portrayed with pink hair or pink accessories. . . . pink-haired magical girls include Minky Momo from "Mahou no Princess Minky Momo" and Hanasaki Momoko from "Ai Tenshi Densetsu Wedding Peach".
However, expressing symbolism is not an answer as to why characters have "crazy" hair colors or the cultural origin of it. Symbolism in hair colors is a byproduct that only developed after the shift from colored hair in non-canon illustrations to colored hair for canon character designs.
The main characters of Magic Knight Rayearth have symbol colors of red (fire), blue (water), and green (wind), but Hououji Fuu's symbolic color is only in her eyes and clothing, not in her hair color. In other words, achieving symbolism through color does not need to make use of hair. The reason why Ryuuzaki Umi can have blue hair is the history of shift from non-canon "crazy" hair color illustration to viable canon hair colors.
The odango style applied to characters of Chinese ethnicity or association is not symbolic so much as it is a form of racial stereotyping.
If it were indeed a symbol, characters not related to China and not wearing cheongsam but who have odango would be associated with some commonly-understood meaning. This is not the case. Although Sailor Moon's odango hair style is so infamous that 3 different characters (Mamoru, Haruka, and Seiya) call her "Odango atama" (お団子頭) or "Odango" as a nickname, she has no connections to Chinese culture and the individual characters' usage of the nickname differs. Mamoru likens Usagi’s hair to nikuman (肉まん, a.k.a. Chinese baozi, or pork buns), whereas Seiya specifically has mochi (餅, rice cakes) in mind, because when Usagi tells him that her name is Tsukino Usagi, he replies with, “Ahh, Tsukimi Dango” (「ああ、月見団子」). Tsukimi dango are small orbs of glutinous white rice eaten to celebrate Tsukimi (Moon-Viewing), a harvest moon holiday. Seiya and Usagi ate the most common kind of odango, which is called mitarashi dango (みたらし団子), together during their date in episode 181 (soy sauce-covered balls on a stick). Other characters in the series also sport odango in their hairstyles but are not all associated with any shared meaning (for example: Sailor Pluto, Sailor Ceres, Sailor Pallas, Sailor Chibichibimoon, Luna and Diana in human form, Tellu, Cyprine and Ptilol).
The hime or ojousama hair style of long, straight hair with either a set of strands or tufts in front of each ear is simply the default Japanese woman's hairstyle common in Heian period, not only for princesses but all women above the peasant class. Scholars are divided on when the history of manga began (some saying it originated from 12th century scrolls, others pointing to the 18th century) but at any rate, this basic women's hair style in manga/anime dates from early manga. However, the hair style itself is still sported by many young Japanese women today, using their natural hair color, in order to give off a conservative image (it is not common to do this style with dyed/bleached hair). Reflecting real life, in manga and anime it remains almost always dark in color (such as black, grey, blue, or purple) to match the natural hair color of people who choose this style. More than symbolizing a princess per se, it is the image that Japanese people associate with a conservative, self-restrained, serious, intelligent, cultured young woman and what girls who want to be thought of as such may go for. On the other hand, this very basic hair style is arguably also often used for frightening characters in Japanese horror, and it is also very common in manga/anime to use buoyant blonde curls for princess personality characters.