When, Where, and How are the Inventories Saved?

Your current inventory is saved in the players folder of your default world as defined in your server.properties folder. Now for the nitty gritty:

MultiInv keeps all other inventories in separate folders inside the "groups" folder. The group names you define in the groups.yml become these folder names. If a world is not inside a group it creates a folder with the world name instead. When you switch between world groups (or worlds not in a group), it saves your current inventory to the world group that you are leaving, looks in the group folder for that world, and loads that inventory. Also, when you switch world groups a file gets written called logoutworld.yml which contains the current world group you are in to check to make sure that you don't spawn in another world when you log in and you have the wrong inventory (It does a quick save to the folder of the last world you were in with your current inventory then gives you back your correct inventory).

Enderchest contents are also stored in the same location as player files, they just have .ec.yml at the end instead of just playername.yml. These get saved a tick after an interaction with your enderchest has occurred. When opening an enderchest the contents of that file for the world group overwrites whatever contents was in the chest before.

Book contents are stored in a separate folder called "books" in the MultiInv folder. The books Title, Author, and contents are made into a unique MD5 hash and then stored inside a file with the format: book_<md5hash>.yml.

The mySQL implementation of these is somewhat similar, with the enderchest, player inventories, and books being saved to different tables. The book contents are saved as a java beans XML file in the mySQL implementation.

Inventory contents format:

Player armor and inventory contents is saved in a field corresponding with the player's game mode. If game modes are to be ignored they are just saved in the survival spot. The Armor and Inventory inventories are separated by a colon (:) and is in the format <inventory>:<armor>. The contents of the inventory are separated by a semicolon (;) and each inventory item has 4 data fields, comma separated (,) in the format: <itemID>,<quantity>,<durability>,<enchantments or book hash>. The enchantments are further separated by a hash symbol(#), with the format of each enchantment being: <enchantmentID>-<enchantmentLevel>.
Update: as of version 3.2.7 release we no longer store ItemIDs and EnchantmentIDs, instead we store the Name of the enchantment or item as defined in the Material or Enchantment enumerator in Bukkit.