How does a screen reader understand a web page?

A screen reader receives structured information that the browser derives from HTML, CSS, JavaScript and ARIA. The browser converts relevant DOM content into an accessibility tree and exposes it through the operating system’s accessibility API. The screen reader then presents names, roles, states, values and relationships through speech or braille.
Semantic HTML supplies much of this information automatically. A heading has a level, a button has a role and accessible name, a labeled input has a relationship to its label, and a list exposes grouped items. CSS can remove content from the tree when it is not rendered, while JavaScript can add, remove or update elements and states.
Screen readers provide different navigation modes. In a document or browse mode, users move through text, headings, landmarks, links and tables. In a focus or forms mode, keystrokes operate fields and widgets directly. The exact commands and mode names vary, but reliable semantics help each screen reader build a usable model.
ARIA can fill gaps for custom interfaces by exposing properties such as expanded, selected or invalid. It does not change visual behavior, add keyboard interaction or repair a misleading DOM. Incorrect ARIA may override useful native semantics and cause the browser to expose less accurate information than the original HTML would have provided.
Inspect the accessibility tree, then test with real screen-reader and browser combinations. Listen to continuous reading as well as structural shortcuts and control interaction. A screen reader does not simply read pixels or visible words; it depends on the programmatic structure and state the browser makes available.