Licensing requirements for contractors vary enormously by state, county, and trade, some states require a general contractor license above a certain project dollar amount, while specialty trades (electrical, plumbing, HVAC) almost always require their own trade-specific license regardless of job size. Working unlicensed when a license is required can void contracts, block you from filing liens for nonpayment, and expose you to fines.
General liability insurance is worth carrying even where not legally required, it covers property damage or injury claims arising from your work, and many clients (especially commercial or property-management clients) simply won't hire an uninsured contractor. Workers' comp becomes relevant the moment you have employees or, in some states, subcontractors.
Once licensing and insurance are in order, protect yourself on each job with a clear written work agreement covering scope, price, and payment schedule, this is what actually gets you paid and gives you standing to file a lien if a client doesn't pay.