The first thing to do is to make your item conversible. This is done by setting bit 11 in the item flags at offset 0x18. This tells the Infinity engine that a dialog can be attached to this item, so check for it. How does it check? The secret is in ITEMDIAL.2DA (short for Item Dialog).
Here are the default contents of that file:
2DA V1.0 * LABEL FILE SW2H14 5689 SW2H14
Item SW2H14 (.ITM) is the talking two-handed sword, Lilarcor. The label is displayed on a button that you will see if you right-click the item for options. In this case 5689 is the string reference for "Converse." Next is file SW2H14.DLG. Extensions are implied, so don't bother putting file.ITM in the first column or file.DLG in the third column. The game will know what to look for.
To add your own talking item, simply add a new row to ITEMDIAL.2DA. For example, if you want your mage to have a talking quarterstaff, you might do something like this:
2DA V1.0 * LABEL FILE SW2H14 5689 SW2H14 STAF01 5689 MYSTAFF
Remember to set the conversible flag in STAF01.ITM, and you'll need to write a dialog for the item, which in this example is named MYSTAFF.DLG. Just talk to the staff the same way you'd talk to Lilarcor. You could also give the item a personal name or something, as was done for Lilarcor. The sky's the limit, and any item can be made conversible.
While the method used to initiate a conversation is limited to the game interface for items with special abilities, item dialogs can be written like most other dialogs. You'd have to come up with an alternative method of initiating a dialog if you wanted the item to be able to initiate a dialog with you, rather than waiting on you to do it. If I remember correctly, one method involves creating an invisible character (with the item's name) near the party and having it start a dialog using the item's dialog file.
If you want your item to talk outside of a conversation, like Lilarcor does in and out of combat, you'll need to add scripting to BALDUR.BCS. Look at Lilarcor's example in BALDUR.BCS (and BALDUR25.BCS) to get an idea of how that's done.