Boy loves girl. Girl hates boy. Boy is trying to get into a good college to impress/join/get a good job for girl. Boy prays for said college in obligatory Hatsumode episode.
This series of events has played out a number of times in anime and manga series. On New Year’s Day, many Japanese go to shrines (Hatsumode) and give prayers for luck and petition from the shrine’s kami. High schoolers may choose to request that they get into the college of their choice (or at all!). Those wanting the best luck will go to Kyushu (Dazaifu Tenmangu Shrine) or Kyoto (Kitano Tenmangu Shrine), where they can visit shrines dedicated to Tenjin, the kami of scholarship.
Tenjin was the name given Sugawara no Michizane after his death. In life, he was an exiled politician who was a well-known poet and scholar. For centuries after he died, Tenjin was known as a kami of natural disasters, but was later noted for being one of education. Today, would-be college students go to his shrines before important exams. Amulets can be purchased to attract good fortune at shrines; a popular amulet for education at Dazaifu Tenmangu Shrine is a set of pencils thought to contains special powers regarding education.
Of course, the more you pay, the more you get. You can pay 5,000 yen ($60) and receive an omamori (charm for an individual person), writing brush and the privilege of receiving a blessing in the main altar area. 4,000 yen ($48) will get you the omamori and the brush, but no prayer blessing. It’s up to the student to decide which (if either) is the better deal.
For all you Japanese tree/plant lovers out there, another interesting connection with Tenjin has to do with ume trees. A particular ume tree grows at the Dazaifu Shrine; legend has it that this tree was the one Michizane wrote about in a famous poem, where he longed for a tree at court. It flew from Kyoto to this site. The poem is below (via Japan: Life and Religion):
When the east wind blows,
Let it send your fragrance,
Oh plum blossoms.
Although your master is gone,
Do not forget the spring.
In a poetic twist, the trees blossom in February, which is when exam results are announced, and so Tenjin shrine festivals are often held that month.
In the end, Tenjin is just one of innumerable kami called upon to provide blessing. In Shinto tradition, kami are used for practical benefit, which is a reflection of Japanese spirituality, which is often practical and self-pleasing rather than the Christian relationship-based spirituality.
Sources: Practically Religious: Worldly Benefits and the Common Religion of Japan by Ian Reader and George J. Tanabe, Jr.; Sugawara no Michizane and the Early Heian Court by Robert Borgen; Wikipedia