In this video, Stabby stabby (a very famous comp spy player in TF2) mentions a technique called the strafe and snap.
How do I execute this technique? Is there a diagram or video that can show me what I need to do as well as how it works?
A strafe and snap is a technique used to backstab enemy players as a spy. The principle is that you get closer to a player, you strafe to the side, you quickly "snap" your view to their side and backstab them.
The principle works on the client/server registration and server ticks. Stabby explains this in a (rather technical) video on his youtube channel: About Face: Backstab Recognition.
In short, it explains that what you as a spy sees on your screen isn't 100% the same as to what the server sees or what your enemy sees, which is how weird "WTF! How was that a backstab?" stabs can occur. Because of this difference you get issues where the enemy player's hitbox can be in places that doesn't look like it actually is resulting in "facestabs" and such.
In a recent reddit AMA stabby explains how to do a strafe-and-snap:
You approach the target head-on, and as you reach melee range, simultaneously release 'w' and switch to 'a' or 'd' (strafe), and snap your view as rapidly as you can towards the target (rotate about 45 degrees).
If you want to practice I suggest going on practicing on a map called tr_walkway. Download it and play on it and practice on bots that keep running forward. It's a tricky technique to learn and requires very fast timing and placement.