What does radiofrequency really do in NMR & MRI?
The radiofrequency pulses and the gradients have completely different purposes in NMR. Radiofrequency pulses are the basic building block of NMR experiments, you use them to manipulate your spin populations and coherences. While each proton has a different frequency depending on its environment, you generally can't (or don't) target individual protons with your pulses. In most experiments you hit either all protons with your pulses, or a specific group of protons. 

Gradients have different purposes in NMR and MRI, what they allow you to do is to change the magnetic field depending on the position inside your sample. In NMR this allows you to remove unwanted signals and select specific coherences. 

In MRI, the gradients are what makes imaging possible. They allow you to encode the spatial position of your protons into their frequency. In NMR you look at all the molecules in your sample at once, you don't care where your molecules are floating around. In MRI the position is important, as you want to know what the protons at a particular point in the body are doing. Gradients also allow you to only look at a slice of the body and not all of it at once.

I'll skip phase encoding in gradients as it is MRI-specific and I don't know much about it. Each part of your question has whole books written about it, so this is a drastically simplified answer.