Information on items, quests, etc. is all requested from the server on demand. Items have an ID and that, plus some other parameters for the things like current enchant, are what's transmitted on a chat channel when you link an item using shift-click.
There is an RPC accessible from LUA that returns a formatted description of the item which is what the UI shows in tooltips. It will also include an ID for the model (model and item ID aren't the same thing because lots of items share a model).
How do you get the IDs of the items in order to request their details? Well, players get IDs back when they loot, when they query the auction house, when they examine other players and a bunch of other ways. It's important to realise that there is no publically accessible list of all items in the game.
Websites like Thottbot and Wowhead rely on users running an addin that captures all this information and more and stores it in the file on logout. A Windows/Mac application then uploads that file to Wowhead's servers which de-dupe submissions, sanity-check it, etc. So to start a site from scratch you are going to need to develop a similar 'looter' addin and recruit players to run it and submit their data to you - the more the better.
There is another technique whereby you write some addin code that just guesses item IDs and requests the details for that item (if it exists). The issue with this is that it's against the WoW terms of use to do it on live realms (they seem to tollerate people doing it on PTRs but I wouldn't try it from my main account).
To learn how to do this you could look through the client UI's LUA source, which is included in human-readable format in the install directory. A quicker route though would be to download one of the client apps from existing WoW database sites and look at their code since that will be focussed on exactly what you want.