In NY State, you study the part of the state code having to do with notaries (http://www.dos.state.ny.us/lcns/lawbooks/notary.html), pass a test on it (requiring an examination fee of $50), and upon receiving a pink “pass slip” from the state department of state, you track down another notary and have yourself sworn in (which brings up the question of who swore in the very first notary).
I imagine the process in other states is fairly similar.
I did this more-or-less on a whim, but my friends and neighbors like having someone around who can witness signatures and such; since everyone needs something notarized once in a while, they send their friends to me. I’ve never charged for the service, but I meet all kinds of lovely people.
In some states, a notary can perform marriages. Alas, NY isn’t one of them—it must be a blast.