When your finger slides and sticks along the surface of the glass as you rub the rim, the rubbing imparts energy to the glass molecules and causes them to resonate. The resonant wave moves around the glass, dragging the water molecules with it, creating a wave of water that you can see near the edge of the glass. The dragging water molecules effectively increase the mass and reduce the energy of the wave traveling through the glass. When the energy is reduced, so is the frequency of the wave in the glass, which is reflected in the pitch of the sound wave that you hear.