Unfortunately no docs on this topic exist yet (like most coders, our fellow Umbracians are scared of writing documentation ;)). There are several ways to build a custom datatype:
The latest and by far the easiest way is to use the UserControlWrapper, which is - like the name says - a datatype which wraps around your custom datatype. Check out the source code here:
http://codegarden.umbraco.org/ftpUploadDataType.zip which should give you a pointer in the right direction. Pay special attention to the umbracoValue-property .. this saves your content back to the database.
The second - and most elegant solution is the old fashioned way to build a datatype. It is a bit harder, as you need to learn more about the infrastructure of Umbraco, but it is my personal favorite. I learnt to use it via this old yet useful piece of code from Christian Palm:
http://www.cpalm.dk/media/1764/multiplemediapickerviasource_source_01.zip. The source code is pretty straightforward. Here you should pay special attention to the Save()-method, anything stored in the _data-variable is stored in the database. Take a look at it with a debugger, and I'm pretty sure it will be easier to grasp.
Best Regards
Simon
Simm.dk - My base on the web - proud Umbracian since 2.0 Beta