Against a chess engine it is not always so easy to sac a pawn and win. Against human beings it is different, but one needs to first learn a bit about pawn structures, positional chess, attacking, and perhaps a bit of chess psychology (defending is usually harder, and can be more time consuming than attacking).
Here's a fresh example :
Here's a pawn sacrifice from a, classic, immortal game :
For further reading and viewing :