There are two usual routes. Most people simply look them up — gaming forums, video sites and glitch wikis collect discovered exploits and pass them around.
The rest comes from experimentation: poking at walls, stacking objects, jumping in odd places and generally trying random inputs until something breaks. Be aware that exploiting glitches in multiplayer games often breaks the rules and can get an account sanctioned.