Basically, it does NOTHING. It's link that links to where it is already.
Usually, you use it when you need to have something that "looks like a link" (the cursor becomes a hand, it's underlined ...) but does not link to a page.
<a href="javascript:alert('somebody clicked on me !!')">
and
<a href=# onclick="alert('somebody clicked on me !!!')">
are equivalent on a browser that has javascript enabled
also, beware that if you use a base href the <a href=#> might actually link to the base href itself.