When a user requests a page that does not exist in a Next.js app, the framework automatically renders the not-found.tsx component if it exists. This component is a React function that returns JSX to display a custom 404 error page. The flow starts with the user request, Next.js checks if the page exists, and if not, it loads and renders the NotFound component. The user then sees the custom message defined in this component. You can customize the heading, text, and layout inside not-found.tsx to provide a friendly and helpful error page. If not-found.tsx is missing, Next.js shows its default 404 page. This visual execution trace shows each step from request to rendering and the state of key variables during the process.