Normally by trying lots and lots of times. There's no magic formula. Having said that, some are easier than others, and once you have practiced a particular glide for a while, there's a tendency to get the "knack" of doing it (so the success rate improves considerably).
Firstly, you need to be sure that it is actually possible (or at least that it isn't definitely impossible). The gap must be no less than 32 units, and be orientated in a direction such that the player can fit through it (remember that the player is really a 32x32 square, with sides always exactly north, south, east and west). If it is a 32-unit gap between two parallel walls, then I think it needs to be fairly short (and the walls must be exactly north-south or east-west).
Secondly, there may well be some engine-specific stuff. I don't know if some ports make some glides impossible, or make them easier. If you simply can't get a known glide to work at all (ever) in the program you're using, try using something with full Doom2.exe compatibility (or with whatever exe you have seen the glide done with).
Beyond that, it's mostly trial and error. Make sure you're exactly lined up with the gap and move exactly towards it. If you get a kind of "wobbling" effect (you're not moving but your view is bobbing, possibly in a jerky way), then it suggests that the glide is close to working. Keep trying, making tiny differences to your angle of approach, speed and also where you actually start off moving from (this means your "footfalls" will be in different places).
I'd suggest a few easy ones to experiment with, but... the problem is that they're all hard until you've got them to work. Maybe the one I do on Darkcvnt.wad map10 is pretty straightforward by the standards of these things (even though there it is three glides in one), and it is very near where you start the map.
In summary, glides are difficult and random things, and I have never seen a detailed account of how exactly they work. That's why you don't tend to see them used routinely. They are mostly used in fairly short demos where the rest of the run is reasonably straightforward*. If the route involves several glides, or a glide and a few other difficult tricks, the chances of success plummet, and on top of that it is unlikely you'll make all the glides cleanly. Even if the time is relatively good compared to what you could get with a non-trick route, a demo where you take ten stabs at a critical glide isn't going to be good to watch. (This kind of consideration applies to some of the ones I have tried on TVR!.wad.)
BTW, you referred to a specific glide trick that you've been trying to duplicate. If you say which one it was, then whoever performed it might be able to give some specific advice.
* OK, so you can ask why there is one in the standard 30nm route (on map19). I believe that's just because the alternative routes are slower and/or more dangerous - the glide can be done in reasonable safety even if it takes several attempts (as it normally does, though Vile seemed to get it down to a fine art in the end), and is a huge shortcut.