
Fanfiction had its beginnings among Star Trek fans in the 70's, when they would trade homemade zines with collected stories about their favorite characters. It remained a niche market until the invention of the Internet by Al Gore, which faciliated the creation of at least 700 thousand billion fanfics every year.
Fans repaid the favor to Gore by writing this.
For some extreme versions of weird sex, see The 5 Most Baffling Sex Scenes in the History of Fanfiction.
Gen or 'general' fanfiction is fanfiction without an erotic focus. Or is rumored to be, as nobody has every actually seen one.

Gen fanfiction.

Above: erotic fanfiction.
Authors of erotic fanfiction
The main writers and readers of all kinds of fanfiction are women, but they particularly dominate this genre. This might be due to the need of many women to experience emotional as well as visual stimuli to enjoy sex. Fanfic comes with emotional bonds to the characters already built-in: they've been formed during the fan's experience of the book/show/music/whatever.
This saves the female reader all the time she would have wasted reading a romance novel, slowly building up a 200-page bond with the characters in order to finally get to the sex. Instead, having already invested the time to read Harry Potter, the reader can immediately dive into some hot Lupin/Snape action.
Which isn't to say men don't write fanfiction, it just tends to all be all about them boning a female character with the addition of "Oh yeah and we were on a spaceship or something."

Examples of male and female fanfiction.
Erotic fanfiction can be divided into three main categories: slash, het and femmeslash.
Slash
Slash began with female Star Trek fans noticing that Spock and Kirk kind of had a thing. (Which let's admit, they did. Come on, that massage scene. Goddam.) Fans started calling the pairing 'Spock/Kirk' or 'Spock slash Kirk', and a genre was born.

The love that launched a thousand ships.
Although slash portrays homosexual relationships, normal gay couples having sex are apparently no fun for fanfic authors, and also kind of gross. It is preferable that the two male characters are not at all involved canonically. In fact, the ideal slash couple is two heterosexual males who are sworn mortal enemies, and also related. This makes the sex, like, more interesting or something.
Het
This is erotic fanfiction between a male and female character. Fans writing het tend to try to make up for its inherent boringness by being really weird. Some het doesn't fit this category and simply portrays a heterosexual couple expressing their canonical love in healthy, life-affirming ways. This makes up about .0001% of all fanfiction.
Femmeslash
This is like slash, but with women. Typically less common than het and slash, possibly because of fanfiction's heavily female readership.

Mary Sues
Mary Sues can be tolerable at times, when the author basically admits that she is just writing down a fantasy about a desired character having sex with her. More often, though, the author is in deep denial, and Mary Sues are annoying, and occasionally disturbing.
The traits of a Mary Sue character include:
For the best example of a Mary Sue ever written, see My Immortal.
Mary Sues have been known to cross the boundaries of fanfiction and become mainstream pop culture.
Hurt/Comfort
A long time ago a woman sat down at her desk and thought "How can I best combine my maternal and nurturing instincts with my massive personality disorder?" Thus the genre of hurt/comfort was born.
Hurt/comfort involves an (inevitably male) character being psychologically or physically abused or tortured and then being nursed back to health by another character. This healing character can be female (usually a Mary Sue) or male.
Like Mary Sues, this type of fanfiction occasionally crosses over into the mainstream.
AU
AU or 'alternate universe' fanfiction uses characters from a particularly fandom after removing them from the context of anything interesting at all.
For example, a Twilight AU fanfiction might star Edward Cullen as a chartered tax accountant who falls in love with his client Bella, and the torture he goes through when he realizes he has a secret and inexplicably powerful desire to report her to the IRS.
MPreg
We don't talk about mpreg around here.
RPF
If the idea of fictional characters having sex isn't disturbing enough for you, you might want to try Real Person Fic, or RPF, which instead uses real people, usually celebrities, for its characters.
This genre is dominated by 'RPS' or Real Person Slash, or the erotic portrayal of two male celebrities. This is understandable, because there just aren't enough occasions in popular Western culture when two heterosexual bandmates, actors or co-anchors have fallen in love and had hot hot sex while letting their female fans watch, and we have to do something about this, god dammit.

We warned you.
The most famous fanvid ever is a Spock/Kirk video set to Nine Inch Nails' Closer, based on the Star Trek episode Amok Time. This video has obtained widespread mainstream acceptance and is now largely regarded as canon. It was screened during the 2008 Star Trek convention in Las Vegas, with running commentary provided by William Shatner.
OTPs
OTP stands for 'One True Pairing' and refers to a fanfic writer's fixation on a particular couple, whether it is canonical or non-canonical. Fixating like this on a particular couple is known as shipping. The most famous example of shippers in action is the Harry Potter fans who became obsessed with the non-canonical Harry/Hermione pairing and became distraught with rage when Harry ended up with another woman.
Cracked Talk on | Fanfiction
Nice article, extremely accurate. Mpreg is just awful, awful, awful; and I want it to go away. And I'm a slash fan.
Also, I wonder how Trent feels about his song being used for a slash video? He is a Trekkie, after all.
MY EYES!!!!
I CAN'T SEE MY EYES!!!!
WTF is wrong with you? haha
Cool article though :)