The basic concept of measuring ESR, is that you send a low V, high frequency AC waveform through the capacitor.
A healthy cap will pass practically all of the waveform.
If it has any amount of internal ESR, it will raise the voltage. (V = R * A)
This simulation shows the output from a healthy cap (switch closed), versus one with 0.3 ohms ESR (switch open).
Notice the amount of current required, to generate voltage on the ESR. Your oscillator must produce this amount of current, or you won't get much of a reading. If you want greater output amplitude, you must inject greater current.
The input resistor is necessary.
Input voltage must be kept low (a fraction of a V), so as not to turn on neighboring devices.
The waveform does not have to be a sinewave. It can be most any type.
Generally speaking, a faster frequency is best, especially for smaller cap values.