Well, when I know there's an enemy about to come around a corner (because we where in a firefight, or because I saw him running in that direction before he went behind the wall) I will start to fire a few rounds when I think he will appear again. Sometimes it works, and gets me an easy kill. I only do this with an MG or SMG though
Sometimes sounds can reveal the position of an enemy too: in 'The Bridge', on the allied side, go down into the storage basement on the right and go to the corner near the sewer entrance: you will hear the axis coming down the tunnel if they run, and with a bit of practice, you'll be able to tell if they are near the opening just by hearing them run (of course, a headset is really helpful)
So, detecting wallhackers the way Mr_nStuff described is only possible if you've not revealed your intentions to the other player (by walking instead of running, or by turning back where you came from or by waiting a short time before you round a corner) Of course, rifles or sniper rifles are the obvious ones to spot, it's a lot harder with SMG and MG...
Enjoy
Fox