A corporation can choose to be treated as an S corporation, which passes corporate income, losses, deductions, and credits through to its shareholders.
Corporations can avoid double taxation by going this route because income is taxed as part of the shareholders’ personal tax returns. Double taxation is exactly what it sounds like, and happens when both a company and its shareholders are taxed.
As a general rule, a shareholder who provides more than small services for the corporation is considered an employee, and therefore would need to pay themselves a reasonable compensation through payroll.
What is reasonable, you ask? The IRS has a bunch of rules it needs to follow, so chat with a tax advisor to ensure your compensation is in line with all federal requirements. Also remember your reasonable compensation must be paid before making non-wage distributions.