You can do this yourself, to a degree.
If you headlights are simply foggy, try plastic polish or wax first. Typically the UV coating on the polycarbonite fades and yellows, and you can sometimes buff it out.
If the headlights are pitted, you will have to wet sand and buff them. You'll want to start at around 800-1000 grit and work you way to 2,500 grit, then buff with rubbing compound and wax. the problem with this is you will be sanding away all the UV coat on the lights and the polycarbonate will be exposed and thus yellow quicker.
If you have tiny little cracks in the lens itself, it's called crazing. There is nothing you can do about that.
It's alot of work, in most cases it's cheaper/easier to just buy new lights.