The NETTUTS.com site has an in-depth tutorial looking at the anatomy of a WordPress plugin:
WordPress is well known for its amazing collection of free plugins. There is one for almost every need you can think of, from backing up your WordPress installation to asking for a cup of coffee or fighting spam. But there are times when none of the available plugins seem to quite do the trick you are looking for. To help you in moments like that, this tutorial will guide you through every step of building a simple, widgetized WordPress plugin with settings.
They break it out into a few sections - the plugin template (files and directories), adding in the first functionality, making the widget for the plugin's output, add in a few settings and you're good to go. You can download the source if you want to dig right in and get going.