now I have only the rows I actually need in the document, so I select them

I can't use the EnteringRow, as I have only the newly added rows in them.
fill in name of the state into second column

Basically, what this line says is following:
- actualRows. - do this on every row
- select(td:nth-child) - select second <td> element (=second column)
- .html - alter its HTML contents as follows
- function(d) {...} - based on the data for this element (bound with .data ealier), return the .name property
fill in the order column

again - select first row, alter its HTML. But this time, use not the data (d) argument, but the second, index (i) argument. It is zero-based, so add + 1.
fill in the medal count column

the beginning is very similar to the title column - again, we select third column and change its HTML based on bound data. But this time, we need to compute the sum of the medals, which is precisely what we do in the for loop. Essentially, we take each elelement of the medals array and add it to the sum variable. Then, we return the sum.
Lets get started with graphis. First, scales

Here we setup scales for x- and y- axis. We use d3.scale function, linear one. We use two functions, domain and range. Domain specifies input data, that is what range of values can be displayed (minimum to maximum, that is the count of years and maximum of medals). Range on the other hand denotes dimensions of the output, in our case, the SVG element (160x30px).
Now add a function that will help us draw the sparkline of medals won

we use d3.svg.line() helper. The .x and .y functions specify, how the coordinates should be computed. For x, we take the index of the data and convert it with the x-scale function defined earlier. The same is done with y-coordinate, we just take the data value and convert it with y-scale.
Draw the actual sparkline (path)

This hunk contains the following: first, we select the fourth column and in it, the svg element. To this element we assign the datum (singular of data) of this row's .medals array. Then we append a path element to the svg and set its definition (the d attribute) to be computed by our helper line function.
alternate method to draw the line

instead of setting .datum, we access the medals in the line helper call
improve the visual of the sparklines

remove yellow background, remove fill of the path, set it to be outlined in 1px #333 line