How does one calculate the amount of oxygen produced by trees?
With detailed mechanistic models. There are a huge number of variables here, and you'll need to account for nearly all of them. Here is a similar project for crops. 

You could try this model for a single tree but I don't envy trying to scale that up to entire countries.

Just to ballpark some figures, you could consider photosynthetic efficiency, average insolation, and shading effects. X amount of light falls on this country on average, and of that light .1% is converted into oxygen, so that's how much oxygen is made.

You could also approach it from the other direction and estimate how much each tree weighs. Tree dry weight is going to be mostly carbon, and necessarily nearly all of those carbon atoms were once carbon dioxide and represent one O2 molecule each. This approach has the advantage of taking into account respiration, unlike the light approach. The light approach measures total oxygen produced, but the carbon approach measures total oxygen released.