There are many different license models available for software, but the choice is not as complicated as it first sounds. There are three major traits of licenses you might be interested in.

1) Sharing improvements

The GNU Public License (GPL V2 or V3) might fit your needs best, as it requires anyone who distributes your work (or derivatives of it) to publish it under the same terms as you did. V3 is similar to V2, but further restricts use in hardware that forbids software alterations. Linux, Git, and WordPress use the GPL.

2) Simplicity and permissiveness

If you want a simple license which allows users of your code to do whatever they want with it as long as they attribute back to you and don't hold you liable, you might be interested in the MIT license. jQuery and Rails use the MIT License.

3) Concern about patents

The Apache License is a permissive license similar to the MIT License, but also provides an express grant of patent rights from contributors to users. Apache, SVN, and NuGet use the Apache License.

Other licenses

There are many other licenses available, but if you want to stay compatible with Ubuntu, you might want to pick a license which is considered free by the Debian Free Software Guidelines.

(Some content re-used from CC-BY-SA 3.0)