A drilling rig works in the exploration side of the upstream industry.

Oil and gas companies build a hypothesis about where a produceable oil or gas basin exists.  The company then contracts a drilling rig to drill down and discover the viability of that basin.

 A service rig is brought to a site after a drilling rig's work is complete.  Oil and gas companies contract service rigs to bring the well 'onstream' (to turn into a producing well).

Oil and gas companies also contract a service rig to shut in a well (when they don't want the well to be producing any longer) or to repair a well.

The pump jack is used when a well is 'onstream'.  The machinery in the pumpjack mechanically pulls oil or gas to the surface.