To begin with the central problem: the exorbitant length. Les Misérables is one of the longest novels in European literature. But length is not just a question of pages, it's also a question of tempo. And this is why Les Misérables is longer than the arithmetic of its length.

In his essay "The Curtain", Milan Kundera writes how "aesthetic concepts began to interest me only when I first perceived their existential roots, when I came to understand them as existential concepts . . ." A form is not free-floating; it is not purely a technical exercise, an external imposition. It is intimately, intricately linked to what it describes. "In the art of the novel," Kundera adds, "existential discoveries are inseparable from the transformation of form."

And the most obvious transformation Victor Hugo effects in the novel's form is sheer gargantuan size. This megalomania was a conscious choice on Hugo's part. To describe his work in progress, he jotted down a list of hyperbolic adjectives: "Astounding, extraordinary, surprising, superhuman, supernatural, unheard of, savage, sinister, formidable, gigantic, savage, colossal, monstrous, deformed, disturbed, electrifying, lugubrious, funereal, hideous, terrifying, shadowy, mysterious, fantastic, nocturnal, crepuscular."

The size was the centre of Hugo's discovery in the art of the novel. And this is visible immediately: it's visible, to the perturbed reader, in the second of this novel's many sentences. The beginning, it turns out, is not a beginning at all. "There is something we might mention that has no bearing whatsoever on the tale we have to tell - not even on the background." Les Misérables begins with a digression from a digression (thus resembling Gustave Flaubert's Madame Bovary, which a few years earlier had begun with a digression, too.) Here, at the start, Hugo was trying to set up a narrative convention, derived from the novel's deep theory.

When the book was finished, Hugo tried - and failed - to write a preface. The preface would have begun like this: "This book has been composed from the inside out. The idea engenders the characters, the characters produce the drama, and this is, in effect, the law of art. By having the ideal, that is God, as the generator instead of the idea, we can see that it fulfils the same function as nature. Destiny and in particular life, time and in particular this century, man and in particular the people, God and in particular the world, this is what I have tried to include in this book; it is a sort of essay on the infinite."

The subject of one of the longest novels in European literature is - what else? - the infinite.

That is why its tempo is so explicit with slowness, syncopated with digression. But in this novel there is no such thing as a digression. Everything is relevant - since the subject of this book, quite literally, is everything: "This book is a tragedy in which infinity plays the lead," writes Hugo. "Man plays a supporting role."

"When the subject is not lost sight of, there is no digression," Hugo wrote later on. But how can the subject of the novel ever be lost sight of, if the lead character is infinity? In that case, nothing will ever be a digression.

Yes, the length of this novel is important. Its quantity is its quality. It represents an answer to a central artistic question, which was not an answer the tradition of the novel has ever quite believed in since. This is one reason why Hugo's novel is so strange, and so valuable.

"Really, universally, relations stop nowhere," Henry James would write, 40 years later, in his preface to the New York Edition of his early novel Roderick Hudson, "and the exquisite problem of the artist is eternally but to draw, by a geometry of his own, the circle within which they shall happily appear to do so." Life was infinite, argued James, but the novel therefore required a form which gave the illusion of completeness. James, after all, had learned the art of the novel from Flaubert. According to this modernist tradition, the novel was an art of miniaturisation, and indirection.

Hugo, however, had come up with a new solution, no less artful than the solution proposed by Flaubert and James. He wanted to create a novel which would try to represent everything by pretending that it did, in fact, represent everything. It would be wilfully ramshackle and inclusive - both on the level of form, and on the level of content: an essayistic novel, or a novelistic essay. "The eye of the drama must be everywhere at once," wrote Hugo. For every plot, seen from the angle of Hugo's style, was infinite.

In some ways, the plot of Les Misérables is simple. It is the story of an escaped convict, Jean Valjean, who determines to reform after being saved by the Bishop of Digne; Javert, the policeman who wants to see him rightfully punished according to the law; a dead prostitute, Fantine, and her illegitimate daughter, Cosette, who is entrusted to Valjean's care; an evil inn-keeping couple, the Thénardiers, and their urchin children, Éponine and Gavroche; and Marius, who falls in love with Cosette, and who is the son of a Napoleonic hero who died believing wrongly that he had once been saved on the field of Waterloo by Thénardier, who was in fact a scavenging thief.

This might sound tightly plotted, taut with melodrama. It might sound like a good plot for a musical. But no one can read Les Misérables for the cleverness or subtlety of its plot. It is not a novel which prides itself on believability. This might seem surprising - since one natural assumption, perhaps, is that improbability in a novel should diminish with length. In Tolstoy's War and Peace, if people coincide, or marry each other, it still seems probable. Every decision retains its fluidity. And yet in Les Misérables this isn't true. In this gargantuan novel, everything seems utterly improbable. Every plot operates through coincidence. Normally, novelists develop techniques to naturalise and hide this. Hugo, with his technique of massive length, refuses to hide it at all. In fact, he makes sure that the plot's coincidences are exaggerated.

It could be argued that the persistent weakness of the plotting is its strength. This, after all, is how coincidence often happens in real life - thinly. But the overwhelming impression is of schlock. And so it might be right to remember that Hugo's original title for his novel was Les Misères, not Les Misérables: which echoed Eugène Sue's recent bestseller, Les Mystères de Paris. Hugo's novel would offer miseries, not mysteries. But it would be part of the same urban pulp tradition. Schlock, however, can make existential discoveries too.

One way in which Hugo emphasises the coincidences in his novel is the persistent failures of recognition. This occurs on the level of the characters - where a father does not recognise his son, or a criminal does not recognise the very person he has been pursuing for years. And it occurs on the level of the narration, where the narrator withholds the name of a character throughout an entire episode. Partly, perhaps, this adds to suspense: it creates moments of dramatic irony. But really it's to create a bifocal effect. Hugo wants a plot that is at once about total randomness, and also total predetermination. The novel, therefore, is written from two perspectives. The perspective of mankind, and the perspective of God - or Destiny.

"We chip away as best we can at the mysterious block of marble our lives are made of - in vain; the black vein of destiny always reappears." Hugo is echoing Hamlet here: "There's a divinity that shapes our ends, / Rough-hew them how we will . . ." His aim is to stress the weird mixture of freedom and predetermination which is the essence of his novel.

Les Misérables is a game with destiny: it dramatises the gap between the imperfections of human judgments, and the perfect patterns of the infinite. The reason for including so much of the world's matter was to work out how mystical the world was. As he put it in Les Misérables: "How do we know the creation of worlds is not determined by the falling of grains of sand? Who, after all, knows the reciprocal ebb and flow of the infinitely big and the infinitely small, the reverberation of causes in the chasms of a being, the avalanches of creation? A cheese mite matters; the small is big, the big is small; everything is in equilibrium within necessity - a frightening vision for the mind." He wanted pattern. But he wanted it only after subjecting the form to its limits, stuffing it with random accreted details - like the man fighting at the barricades, who "had padded his chest with a breastplate of nine sheets of grey packing paper and was armed with a saddler's awl". Meaning could be revealed only by slowing down the tempo of each scene: pausing it in the infinity of its detail.

What is relevant? This is the meaning of Hugo's long novel and its slow tempo - heavy with detail. How can you know what fact will emerge, and destroy you? How can you know what will become a trap, and what will not? We live our lives so blissful in our ignorance of an infinity which could invade us at any moment.

Hugo's form, predicated on length, on digression and detail, is a deliberate accretion of overlapping examples: his scenes are all variations on the same theme. That is why the novelist Mario Vargas Llosa has described how Hugo's main scenes are "irresistible traps" - volcanic craters, where chaos suddenly acquires logic. (And yet, how strenuously do Hugo's characters try to resist the traps of the world!)

Whether Hugo is writing about the historical battle of Waterloo or the fictional journey to Arras, his scenes obey the same constraints: a mass of infinite detail, which coalesces to form a trap, an unstoppable destiny.

According to Hugo, the battle of Waterloo was determined by the weather. "If it hadn't rained during the night of June 17-18, 1815," writes Hugo, "the future of Europe would have been different. A few drops of water, more or less, brought Napoléon to his knees. So that Waterloo could be the end of Austerlitz, Providence needed only a bit of rain, and a cloud crossing the sky out of season was enough for a whole world to disintegrate."

It looks like an essay on Waterloo; just as Valjean's story looks like a story about the tribulations of an escaped convict. In both cases, however, the true subject is chance: "the immense strokes of luck, good or bad, that are calibrated by an infinity that escapes us".

Hugo's length does not just represent a philosophy: it is also a politics. In Les Misérables, there is a correlation between the infinite and the unknown; and another correlation between the unknown and the miserable - the destitute. This is why Hugo can move so fluently from a detail to its moral or political halo. Everything is linked by his thematic network. Perhaps it's a pity, therefore, that all that survived of his preface to the novel was a single, dogmatic sentence: "As long as social damnation exists, through laws and customs, artificially creating hell at the heart of civilisation and muddying a destiny that is divine with human calamity; as long as the three problems of the century - man's debasement through the proletariat, woman's demoralisation through hunger, the wasting of the child through darkness - are not resolved; as long as social suffocation is possible in certain areas; in other words, and to take an even broader view, as long as ignorance and misery exist in this world, books like the one you are about to read are, perhaps, not entirely useless."

Hugo's epigraph limits his novel too neatly. It's true that the same triad of the needy - which corresponds to Valjean, Fantine and Cosette - is restated by two characters in the novel. But Hugo was not simply a political writer. How could he be? His subject was the infinite.

In an abandoned section on prostitution, Hugo wrote: "The portion of fate that depends on man is called 'misère', and it can be abolished. The portion of fate that depends on the unknown is called 'douleur', and this must be considered and explored with trepidation." He was an ontological pessimist, and a historical optimist. This was why Flaubert was unfair to mock Hugo for "the Catholic-socialist dregs . . . the philosophical-evangelist vermin" who admired his novel. Hugo's novel was grander than its politics. It was not so limited.

Many years earlier, in his preface to a collection of poetry, Inner Voices, dated June 24 1837, Hugo had said that the poet's duty was to elevate political events to the dignity of historical events. This fluidity between the political and the historical is central to Les Misérables. Hugo wanted to transform politics into history, and rewrite history so that it included the unknown, the ignored, the forgotten - a version of history that would inevitably, therefore, be both an exercise in philosophy and an exercise in politics.

Les Misérables, let's remember, was a historical novel on its first publication. But what is a historical novel? With Les Misérables it allowed Hugo to rewrite history: to show how far history is fiction; how far fiction had always been taciturn about the mass of its editing.

In his chapter "The Year 1817", a four-page list of minute events, Hugo concludes: "History neglects nearly every one of these little details and cannot do otherwise if it is not to be swamped by the infinite minutiae. And yet, the details, which are wrongly described as little - there are no little facts in the human realm, any more than there are little leaves in the realm of vegetation - are useful."

It is this devotion to the infinitely unknown that makes Hugo so meticulous in giving the reader Valjean's prison numbers; and why Valjean's name is almost a tautology. Valjean is everyman: the anonymous, the ignored. That is the secret of his repetitive name (like Nabokov's criminal hero in his novel Despair: Hermann Hermann, a misprint for Mr Man Mr Man).

And it is also why Hugo is so careful to set the novel in the suburbs of Paris. It was the communist surrealist Louis Aragon who stated that "with Victor Hugo, Paris stops being the seat of the court to become the city of the people". Hugo was expert at describing the formless suburbs: "that funny, rather ugly semi-rural landscape, with its odd, dual nature, that surrounds certain big cities, notably Paris. To observe the urban outskirts is to observe the amphibian. End of trees, beginning of roofs, end of grass, beginning of pavement, end of furrows, beginning of shops, end of ruts, beginning of passions, end of divine murmuring, beginning of human racket . . ." Hugo's novel restores real life to the truth of its infinite length.

Before he describes the barricades of the 1832 revolution, Hugo returns to his theory of history, which is really a theory of detail. "The events we are about to relate belong to that dramatic and living reality that the historian sometimes neglects for want of space and time. But this is where, and we insist on this, this is where life is, the throbbing, the shuddering of humanity. Little details, as I think we may have said, are the foliage, so to speak, of big events and are lost in the remoteness of history." Hugo himself had already provided an example of this foliage - in his description of the battle of Waterloo. He had reinstated an episode which more prudish historians preferred to omit, describing the final desperate resistance of some French soldiers: "They could hear in the crepuscular gloom that cannons were being loaded, wicks were being lit and gleamed like the eyes of tigers in the night, making a circle around their heads, all the shot-firers of the English batteries approached the cannons, and then, deeply moved, holding the moment of reckoning hanging over these men, an English general - Colville according to some, Maitland according to others - cried out to them: 'Brave Frenchmen, give yourselves up!' Cambronne replied: 'Shit!'"

This word shit - which Hugo called "the misérable of words" - electrifies the long network of metaphors and themes in the novel. It relates the battle of Waterloo and its themes of chance and destiny to the sewers through which Valjean wanders after he has left the barricades; and it links the sewers to the underground slang, the argot, which Hugo delights to record in his prose. Most prison songs, after all, came from a great long cellar at Châtelet - "eight feet below the level of the Seine".

But it also invigorates the moral and political structure of the novel. Les Misérables is based on an ethics which believes in the triumph of the defeated.

At the novel's climax, Hugo describes how Marius "began to have an inkling of how incredibly lofty and solemn a figure this Jean Valjean was. An unheard-of virtue appeared to him, supreme and meek, humble in its immensity. The convict was transfigured into Christ." The novel possesses a logic of conversion. It is there in Javert's conversion towards the end of the novel: his sense of "some indefinable sense of justice according to God's rules that was the reverse of justice according to man". And it is there in that miserable word "Shit!".

After describing Cambronne's last stand, Hugo describes the meaning of this word "Shit!", as shouted to the English at Waterloo. "To say that," he writes, "to do that, to come up with that - this is to be the victor." It was really Cambronne who won at the battle of Waterloo. That is Hugo's crazy, novelistically persuasive theory: Cambronne, who had made "the last of words the first". The triumph is truly his.

In Hugo's list of Parisian gangsters active in the 1830s, there is a stowaway:

"Panchaud, alias Printanier, alias Bigrenaille, or Hotwhack, Springlike, Golightly Brujon. (There was a whole dynasty of Brujons; we can't promise not to say more about this later.)

"Boulatruelle, the road-mender we have already met.

"Laveuve, or the Widow.

"Finistère.

"Homère Hugu, a black man.

"Mardisoir, or Tuesday night."

Homère Hugu, a black man! This alias is not the only one Hugo adopts in the novel, which is punctuated by stashed versions of the name Hugo. But Homère Hugu sums up his prose style in Les Misérables: a first-person warped autobiographical voice which improvises a slang version of epic.

This voice is the great formal invention of Hugo's novel - the support to the novel's length: a narrator who is unembarrassed by sententiae: sentimental interjections, melodramatic addresses to historical characters, one-word paragraphs, chains of adjectives linked only by their sound, characters who freeze into rants. A narrator devoted to the prolix, the comprehensive.

For the world of Les Misérables is one which has been comprehensively transformed into language. It is a new world, with its own conventions. And the gigantism of its plot operates through the range of Hugo's vocabulary. Nothing escapes Hugo's omnivorous collage, not the argot of the criminal underworld, nor songs in dialect, nor the scraps of paper scribbled with revolutionary notes which Hugo loves quoting - incomprehensible fragments, like imported nonsense poems.

This novel invents the idea of language as history, as deposit, as waste. It is a huge act of restitution: an exercise in the ignored. Yes, Les Misérables is a microcosmic, metaphoric novel. So that even Baudelaire - the modernist poet, the poet of dense economy - could write in Le Boulevard, on April 20 1862, that it was "a novel constructed like a poem". Its length is a formal property. Its style is saturated in its length.

But then again, Baudelaire didn't know the lengths to which Hugo would still go. In April 1862, after all, Baudelaire had only read Part I: Fantine. The rest was still to be published.

· Les Misérables by Victor Hugo is published by Vintage Classics this month.