After incorporating the company by filing a Certificate of Incorporation, the incorporator appoints the initial director(s) to the Board using a document called "Action by Incorporator." Usually this document also adopts the initial Bylaws.
Many startups have only one director to start with (the founder). Others will have two or three. Odd numbers are preferable because they avoid the possibility of a tie vote.
The Bylaws (and sometimes also the Certificate of Incorporation) establish the number of seats on the Board. Sometimes it's a range (e.g., 3 to 7), to be set from time to time by vote of the Board itself. There can be unfilled vacancies; usually the Bylaws allow the other incumbent directors to fill any vacancy by vote.
Election of Directors
If not appointed in the initial Action by Incorporator, additional directors need to either be appointed by vote of the incumbent director(s), if allowed by the Bylaws (e.g., to fill an authorized but vacant seat), or elected by shareholder vote. Well-drafted charter documents allow these things to be done by unanimous written consent rather than holding a meeting.
At the beginning, directors are usually just the founders and perhaps a friendly person or two that's helping advise the company. A small "friends and family" round or convertible debt bridge financing is unlikely to change that. When the company closes a more substantial round of equity financing, usually the investors will ask for a Board seat. The mechanics and documentation are beyond the scope of this answer, as things get complicated in a hurry: The investment usually is in Preferred Stock, the Certificate of Incorporation is amended or restated to include many pages of additional language relating to the rights and preferences of the Preferred; a set of "protective provisions" will be negotiated giving the Preferred investors veto power over certain fundamental actions; and so forth.
Most directors will want to be indemnified by the company against liabilities connected to their service. This is usually done both in the Bylaws and with a separate Indemnification Agreement entered into with each director. Those agreements should be approved by shareholders to maximize their chances of being enforced in court.
Outside Independent Directors
It's a good idea to start cultivating potential independent directors early in a company's life. If things go well, you'll want to add at least one or two to offset the presence of investor directors on the Board; it reflects well on the company to have respected/prominent outsiders on the Board; and if the company every makes it to an IPO, stock exchange rules these days require independent outside directors on the Board.
Additional resources provided by the author
See link below for many additional resources for founders, including a "Top 15" list of essential free online resources for early stage entrepreneurs.