This tutorial provides a pattern to develop a JQuery plugin.
Why create a jQuery plugin?
A small list of reasons given in the article:
And this article does not mention it but is important enough, do you need the plugin. Some people say check if exist one plugin doing something similar, but that is more relative.