Harvesting Resources in Civ6

Solution 1:

In order to get the Niter resource you'll need to remove the farm and build a mine instead.

Different resources(luxury or strategic) need different improvements. For example, to gain sheep you'll need to build a pasture on that tile, to get oil you'll need to build an oil rig, etc.. When your worker is on the tile that has a resource, it'll usually recommend the improvement for you.