Literature, the word, literally means "written in the form of letters." So, anything in written form is literature. Horace, a Roman poet from the Classical Age, defined the purpose of poetry as "Prodesse et Delectare," where prodesse means learning or instruction, in other words, didacticism, and delectare means pleasure and entertainment, in other words, aestheticism. This helps us categorize literature into Applied Literature and Pure Literature.
Applied Literature contains only didacticism, for instance, physics, mathematics, chemistry, and so on. Though you might be thinking, What if someone finds mathematics entertaining?
Well, in such a situation, all we are left to do is wish them the very best. :D But the point to notice is that people can enjoy many things, and that does not necessarily make them literature. Here, the focus is on the subject-intent, that is, physics is not written with the purpose of entertaining but rather to inform, educate, and explain physical phenomena.
Then there is Pure Literature, which is our concern here, and pure literature necessarily contains the element of aestheticism, while didacticism is conditional and depends on the choice of the author. Generally speaking, whenever we use the word literature, it implies pure literature. But does it make series like Terry Deary's Horrible Histories pure literature? Well, yes, since it is an exaggerated and comedic fictionalization of real history.
Then again, we categorize literature into three ways: fiction, fictionalization, and non-fiction. Fiction is basically pure literature based on imagination, lacking real history or real-life personalities. It includes novels, drama, and poetry. Fictionalization is where you fictionalize a real historical account or a real person's life. For instance, Jon Krakauer's Into the Wild. And finally, non-fiction, which is also considered pure literature but concerns reality, such as literary essays, biographies, and autobiographies.
Then yet again, there is another way to categorize literature, which is the distinction between prose and poetry. Except for poetry, all other forms of pure literature are basically prose. Poetry and prose have certain distinctions. For instance, poetry has rhythm, meter, a specific structure, figurative language, and poetic devices, while prose often lacks these features.
In case you are wondering, yes, there are more ways to categorize literature. Another famous way to understand literature is through literary trends, and there are two popular schools of thought within that context. There is Art for Art's Sake, which propagates that pure literature should contain only aestheticism, and its proponents were Théophile Gautier, Walter Pater, and Oscar Wilde, among others. Though, ironically, many of the proponents of Art for Art's Sake themselves included didacticism in their literature. For instance, Oscar Wilde's The Nightingale and the Rose, despite its aesthetic beauty, conveys a moral critique of materialism, superficiality, and the failure to appreciate genuine sacrifice. Then there is Art for Life's Sake, which advocates the inclusion of didacticism alongside aestheticism. Leo Tolstoy, George Bernard Shaw, H. G. Wells, Chinua Achebe, and Munshi Premchand are among its notable proponents.