Rack provides a minimal and modular interface for building web applications in Ruby. It handles HTTP requests and responses, acting as an interface between web servers and frameworks. Rails uses Rack middleware to handle requests, with Action Controller implemented as middleware. The routing table maps routes to controller actions. When a request comes in, it is passed through middleware before being routed and dispatched to the controller action to generate a response.