The detection of your pulse via your finger via light is called Photoplethysmogram.
Light shines onto the finger and a light detector measures the light that returns.
We use green light, which is absorbed by red blood. The redder the blood, the more green light is absorbed. The blood pumping through one's finger will change the absorption of the light. Not by much but enough to measure. These variations can be plotted over time to see the changes.
The readings will also vary by ones breathing and if the finger shifts while taking readings. So make sure you keep your finger still, to avoid unintended light changes.
Often times you'll see blood oxygen clips like these, they keep the finger in place by pressure, and have the LED and sensor at the finger tip: