I can tell because it burns just a wee bit in the back of my throat and it doesn't taste as sweet and nutty as usual. Always make sure it's refrigerated and check the expiration date. I recommend starting with the more expensive Barleans as it's nearly always fresh if it's been refrigerated. Then you will be able to recognize if you buy a cheaper brand and it's rancid. A cheaper brand I've had good luck with is the Whole Foods house brand.
If it's really rancid it burns your throat and tastes like it was drained from a pontiac.