Each company employs a transfer agent to track the details of their shareholder ledger. This record is an ongoing accounting of every legal title holder that directly owns shares, and how many shares that legal title holder owns. In the time leading up to shareholder meetings, a record of the ledger called a stock list is created predominately in order to track who has claim to voting rights.
The majority of shares represented on the company ledger are under the names of brokers and institutions. Although the brokers and institutions themselves may have account holders, clients, or borrowers which are in control of the shares, they retain legal ownership. The issuer does not have any visibility into the names or details of these beneficial owners, and only can see a total aggregate number for each broker or institution.
While positions above 5% of a company are required to be independently filed by SEC regulation, all other holdings are in a separate realm of accessibility. Shareholder ledgers are public to legal title holders of the relevant security, per Federal law . Additionally, the state of Delaware has the same legal rights in place for legal title holders of securities . Delaware is the incorporation location for over half of Fortune 500 companies, and over 90% of IPOs .
In order to gain access to the shareholder ledger and view the breakdown of owners who lay claim to less than 5% of the company each, a curious party must either be a legal title holder or must be able to prove their status as a beneficial owner, which can be difficult to establish. The process for this can vary based on the by-laws of the specific corporation in question. The by-laws are a required document for publicly traded companies and will be available through the SECs document search tool EDGAR . Alternatively, most companies host their by-laws on their own website and can be found with an online search engine.
If the investor is interested in gaining direct access to a list of shareholders and their positions, it would be much easier to undergo the process of moving shares through the Direct Registration System first, and then seek access as a legal title holder, as opposed to the additional steps presented by beneficial ownership to prove identity.
An important distinction is that it is not the day-to-day shareholder ledger which is viewable through these laws and methods, but a stock list. The stock list is a snapshot of the ledger at a specific moment - at that moment, all parties which own shares and are entitled to votes have been decided. The stock list exists as a reference point for the shareholder meeting, and the shareholder ledger continues on and continues to reflect ownership in live terms.
As a large proportion of companies are hosted in Delaware, let's also examine the specific state law which covers this. Once an investor meets the qualification to view the stock list, they are generally able to view the ledger during the prior 10 days leading up to the annual stockholder meeting. However, the stock list is not available at the meeting itself. Here is the relevant section of the Delaware legal code:
"(a) The corporation shall prepare, no later than the tenth day before each meeting of stockholders, a complete list of the stockholders entitled to vote at the meeting; provided, however, if the record date for determining the stockholders entitled to vote is less than 10 days before the meeting date, the list shall reflect the stockholders entitled to vote as of the tenth day before the meeting date, arranged in alphabetical order, and showing the address of each stockholder and the number of shares registered in the name of each stockholder. Nothing contained in this section shall require the corporation to include electronic mail addresses or other electronic contact information on such list. Such list shall be open to the examination of any stockholder for any purpose germane to the meeting for a period of 10 days ending on the day before the meeting date: (i) on a reasonably accessible electronic network, provided that the information required to gain access to such list is provided with the notice of the meeting, or (ii) during ordinary business hours, at the principal place of business of the corporation. In the event that the corporation determines to make the list available on an electronic network, the corporation may take reasonable steps to ensure that such information is available only to stockholders of the corporation." 
"(b) Any stockholder, in person or by attorney or other agent, shall, upon written demand under oath stating the purpose thereof, have the right during the usual hours for business to inspect for any proper purpose, and to make copies and extracts from:
(1) The corporation’s stock ledger, a list of its stockholders, and its other books and records"
A company can choose to provide online access to the stock list, or provide access to visitors at their main place of business and during business hours. No appointment is directly necessary, but a company incorporated in Delaware can refuse access to the stock list. In that case:
"(b) If the corporation, or an officer or agent of the corporation, refuses to permit examination of the list by a stockholder, such stockholder may apply to the Court of Chancery for an order to compel the corporation to permit such examination. The burden of proof shall be on the corporation to establish that the examination such stockholder seeks is for a purpose not germane to the meeting. The Court may summarily order the corporation to permit examination of the list upon such conditions as the Court may deem appropriate, and may make such additional orders as may be appropriate, including, without limitation, postponing the meeting or voiding the results of the meeting."
1. Title 17, Chapter II, Part 240, § 240.14a-7(a)(2)(ii) of the code of Federal Regulations https://www.ecfr.gov/current/title-17/chapter-II/part-240/section-240.14a-7
2. Title 8, Chapter 1, Subchapter VII, Section 220 of the Delaware Code; https://delcode.delaware.gov/title8/c001/sc07/index.html#220
3. 2016 Mental Floss Article: Why Are the Majority of U.S. Companies Incorporated in Delaware?
4. SEC EDGAR Company Filings search
5. Title 8, Chapter 1, Subchapter VII, Section 219 of the Delaware Code;