They are issued by states, counties or municipalities, depending on where your business is or what kind of trade you practice. In CO, electricians and plumbers are licensed by the state, while heating contractors are licensed by local entities (so you basically have to have a license in every city and/or county you work in - a real pain). Usually to obtain a license you need to produce letters from licensed contractors you have worked for to prove so many years of job experience and certain type of job experience (so many years doing different aspects of the trade) as well as take a test involving lots of knowledge in your area (calculations, the science of your trade, etc.) and usually a test on the Uniform Building Code or the International Building Code, depending on your locality and what code your licensing body has adopted.
I was quoting Ouderkirk, you needed to post that to him.