There is no 'finding' , that is an arbitrary choice. Once you have divided the interval 0 to 1 in n subintervals, each having length , and so right endpoints , , , ..., , ..., you must choose one x in each interval. Here they have just chosen the simplest- the midpoint: . You could as easily have chosen or or , etc.
In the last problem, all of the individual areas are rectangles or trapezoids. Do you know the formulas for area of a rectangle or trapezoid? Find the area of each and add them.