Unlike previous SharePoint rendering systems (XSLT in 2010 and CAML in 2007), CSR is client-side. The only thing server-side webparts do is they put a huge bulk of raw data into the page, in JSON format. This data become JS object when the page loads, and from then on the Client Side Rendering begins.
So basically, what CSR does is it gets the JS object with raw data as input, and renders huge HTML string based on it:
After HTML string is fully formed, it is inserted into the DOM.
CSR processing of the raw data is divided into stages, each represented by one overridable JS function. Each function returns its own chunk of HTML. Stages are often nested into each other. The stages order for list views is the following:
Group, Item and Field functions can be called many times, while View, Header, Body and Footer are called only once.