I have reservations about calling this post 'Slash fanfiction' as if I'm going to be expressing my definitive viewpoint on it. There's no way I could do this, since almost every slash story I read slightly alters my view on what it's for and what it's doing.
Slash, for non-readers of fanfic, is a term describing fics revolving around homosexual pairings (it's opposed to 'het', heterosexual, pairings). Many of these are fairly improbable pairings, such as Snape/Harry (or 'Snarry'); others, such as Sirius Black/Remus Lupin, are more understandable, especially given the similarity in the two's animal forms, and their notorious affectionate embrace towards the end of Prisoner of Azkaban.
Suman Gupta, in the revised edition of his excellent book Re-reading Harry Potter, spends a small part of the last chapter trying to theorise why there is so much slash fiction. One possibility he moots is that unusual pairings, such as Draco and Harry or Ron and Draco, are trying to provide an alternative route to resolving the splits in the wizarding world through romantic love, rather than confrontation and violence. He also suggests that the slash presence on fanfic sites is an emancipatory move by fans to fill in the social gaps in the wizarding world, where only coy hints of homosexuality are found. (I'm ignoring Rowling's declaration that Dumbledore was gay, since there was so much slash fiction before Deathly Hallows was published and she made this statement that it hardly matters; at any rate Dumbledore is only one of a very large number of characters used in slash pairings.)
It is true that there are characters whose sexual lives we know very little about, such as Charlie Weasley or Sirius Black. But there are also those who we know are in heterosexual relationships, such as Lupin (briefly, before he and Tonks are murdered). Of course you could theorise that Lupin only marries Tonks because Sirius has been killed and he is searching for comfort. But most SBRL fics (as they're coded) don't do this: they either go backwards, looking at the characters' lives before 'canon' (the published texts), or they choose an alternate universe (AU) approach and rewrite their lives.
So why this intense urge to write homosexuality into almost every fissure of the Harry Potter? Go to fanfiction.net's Harry Potter section, relax the ratings filter so you can view 'M'-rated fics, and search for almost any pairing of male characters of the same generation/era, and you'll find some, I can pretty much guarantee. Lucius Malfoy and Blaise Zabini (Draco's aristocratic classmate). Lucius and Harry. Snape and James Potter. Even 'twincest' between Fred and George Weasley (the loosening of traditional sexuo-moral boundaries in the fanfic realm will be looked at in the future at some point). It is extraordinary - and, for me, discovering this world at the age of 14 - exciting and liberating.
Plus, Gupta cites a survey done by a fanfic site that suggests most slash fanfics are written by women in their twenties. Most fanfiction in general is written by female fans - this is pretty much accepted - so perhaps this shouldn't be a big surprise. And there are, comparatively, very few fics with female slash pairings. Ginny/Hermione appears sometimes (but compare 57 pages of this pairing on fanfiction.net to 398 pages of stories about Sirius Black and Remus Lupin). I read an excellent one about Professors Hooch (Quidditch mistress) and McGonagall once, but this was years ago, and there are still only 3 pages of stories with a 'McHooch' focus.
This is the bit where I have no answers. Is it to do with the nature of male vs. female characters in the series? In general, females are pretty marginalised: they're eccentric, like Tonks and Luna, maternal, like Molly Weasley, overly girly and flirty, like Fleur, Lavender and Parvati or mad like Bellatrix Lestrange (the only major female Death Eater, by the by). Hermione is more concrete, and highly intelligent, but she's also ripped to pieces in many ways: she can be vain and shrill and bossy. Umbridge is evil and clever, but ridiculous with her obsession with fluffy kittens and pink. Cho Chang is impatient and weepy. The only female character who seems to have real steel and charisma, as far as my reading goes, is Ginny Weasley, and unfortunately she doesn't really mature until the sixth book.
The male characters, by comparison, dominate the series in number and personality: look at Dumbledore, Voldemort, Snape, Draco, Sirius Black, James Potter, Wormtail, Cedric Diggory, Viktor Krum, Mad-Eye Moody, Kingsley Shacklebolt, Fudge, Rufeus Scrimgeour, Argus Filch etc. All very memorable characters, with, in my opinion, much more solidity and individuality. More, in short, to hang a fanfic on.
There's also a culture of heterosexual masculinity throughout the books which it's quite fun to disrupt by introducing a strong sexual element into it. Take this fic, 'I'm Not in Denial', which begins with a typical brawl between Draco Malfoy and Ron Weasley that turns into a sexual assault. The fighting goes on as the relationship develops - most of the time the two don't know whether to fight or fuck, to put it crudely. This is an extreme example, but it's posssible that fans find this much more interesting - and unlikely, perhaps, so therefore more novel? - to read than a typical lesbian pairing, which is often based on deep meaningful conversations and frustrations with the men in their lives (certainly this is true of Ginny/Hermione).
Could it also be argued that women have the same kind of fascination with male homosexuality as men do with lesbianism, if male-aimed porn is anything to go by? This is certainly possible, and the lack of erotica addressing this interest could certainly be attributed to the domination of the sex industry by male desires and the expectation of women to fulfil them - just in the same way that there are hardly any male prostitutes compared to the numbers of females.
I suppose I don't know the answer. I certainly continue to find male homosexual relationships deeply interesting - perhaps it's the exoticism of it, givenI will never be able to participate in such a relationship myself. I don't know. But, going back to 'I'm Not in Denial', one thing I like very much about it is the effort to address stereotypes, the demonstration that males can experience homosexual desire without being feminised at all. It's a shame there aren't more teenage boys reading these fics, especially those who are uncertain about their own sexuality, but at least the stories exist. It's a start.