When an Express server receives a request, you can use res.set to add headers to the response. Each call to res.set adds or updates a header key and value inside the response object. These headers are stored internally and are not sent immediately. Only when you call res.send or res.end does Express send the headers along with the response body to the client. For example, setting 'Content-Type' to 'text/plain' and a custom header 'X-Custom-Header' to '12345' will prepare these headers. When res.send('Hello World') is called, the headers and body are sent together. This process ensures headers are complete before sending. You can call res.set multiple times to add many headers. Changing a header key updates its value before sending. Understanding this flow helps you control response metadata effectively.