Ramanujan was born at Erode, Madras Presidency (now Tamil Nadu) in a Tamil Brahmin family of Thenkalai Iyengar sect. His introduction to formal mathematics began at age 10. He demonstrated a natural ability, and was given books on advanced trigonometry written by S. L. Loney that he mastered by the age of 12; he even discovered theorems of his own, and rediscovered Euler's identity independently. He demonstrated unusual mathematical skills at school, winning accolades and awards. By 17, Ramanujan had conducted his own mathematical research on Bernoulli numbers and the Euler–Mascheroni constant.
Ramanujan received a scholarship to study at Government College in Kumbakonam, which was later rescinded when he failed his non-mathematical coursework. He joined another college to pursue independent mathematical research, working as a clerk in the Accountant-General's office at the Madras Port Trust Office to support himself. In 1912–1913, he sent samples of his theorems to three academics at the University of Cambridge. G. H. Hardy, recognizing the brilliance of his work, invited Ramanujan to visit and work with him at Cambridge. He became a Fellow of the Royal Society and a Fellow of Cambridge. Ramanujan died of illness, malnutrition, and possibly liver infection in 1920 at the age of 32.
During his short lifetime, Ramanujan independently compiled nearly 3900 results (mostly identities and equations). Nearly all his claims have now been proven correct, although a small number of these results were actually false and some were already known. He stated results that were both original and highly unconventional, such as the Ramanujan prime and the Ramanujan theta function, and these have inspired a vast amount of further research. The Ramanujan Journal, an international publication, was launched to publish work in all areas of mathematics influenced by his work.
In December 2011, in recognition of his contribution to mathematics, the Government of India declared that Ramanujan's birthday (22 December) should be celebrated every year as National Mathematics Day, and also declared 2012 the National Mathematics Year.
On his religious views, Ramanujan practices Hinduism. He credited his acumen to his family goddess, Mahalakshmi of Namakkal. He looked to her for inspiration in his work, and claimed to dream of blood drops that symbolised her male consort, Narasimha, after which he would receive visions of scrolls of complex mathematical content unfolding before his eyes.
Hardy argued that Ramanujan's religiousness had been romanticised by Westerners and overstated—in reference to his belief, not practice—by Indian biographers.
A Disappearing Number is a recent British stage production by the company Complicite that explores the relationship between Hardy and Ramanujan.
The novel The Indian Clerk by David Leavitt explores in fiction the events following Ramanujan's letter to Hardy.
On 22 March 1988, the PBS Series Nova aired a documentary about Ramanujan, "The Man Who Loved Numbers" (Season 15, Episode 19).