There are tons of "official" fanifction books out there for a lot of popular TV shows and movies. I've seen Star Wars, Buffy the Vampire Slayer, Charmed, Criminal Minds, The Unit, and probably a hundred more. But how does one go about publishing one of these books?
Sadly, in most cases the first step is to be a published author. I've looked into a few of these, mostly the old BBC Doctor Who book line back before the series came back, but the rules seem to be the same for most of them.
Mainly though, they want people who already have a track record. That means you're going to have to put out a few original books before you can seriously talk with them about doing the writing.
Now, assuming that you have published a few books and you do want to break in, there are different ways. One is to ask your agent to look into it (they are good for that), another is to go to a convention focused on that show if the editors for the book line will be there. You can usually tell that from the posted information about the con before going. Once there sit down and talk with them and see what you can do.
Sadly the Star Trek: Strange New Worlds writing contest has ended, which is too bad. They took amateur short stories and the best got published in anthologies. It launched a few careers and was fairly successful. Hopefully they will bring it back someday.