TL;DR: Finding outright fraud is not the job of peer review; it is not difficult to cheat in a publication and it is not easy in general to discover it. However, fraud in important work will ultimately be found out. Fraud in unimportant work may linger for a while because nobody will bother to use or reproduce the results.
Peer review rarely can identify fabricated data directly (there are exceptions, see the case of Jan Hendrik Schön, where graphs were identically reproduced in different contexts; or cases where image manipulation can be clearly established).
However, note that fabricating data is the ultimate scientific crime, even worse than plagiarism. If the question is important, you waste other researchers valuable time and direct them away from other more productive lines of work.
Furthermore, if the question is important, you will be found out. It may take time, but you will be found out. This is how science works. It makes mistakes, results are foggy, but the fog will clear at some point. If you ever fabricated data, you will have a very hard time to ever be believed again - actually, I would venture so far as to say
you will never be believed again. No one wants to waste their time on work by someone who is not just sloppy (such as the Cold Fusion case), which is bad enough, but actively mislead their peers.
If the question is unimportant, and one is out of the eye of scientific scrutiny, then one may survive for a while in the system (there were cases where whole careers were built on this over longer periods); however, then, what's the point? What's a charlatan without an audience?
Peer review is mostly a sanity check for the most coarse omissions, mistakes, or really clumsy fakes. But discovering the latter is not the purpose of peer review. Given above incentives to not lie, peer review assumes that the authors have given their best shot at being truthful and it tries to capture honest mistakes; another role is evaluating the quality of the research (which is often very subjective and may have a latency of decades before it becomes more "objectively" evaluable).
[Addendum: One major class of issues could theoretically be discovered by peer review in a similar way as vote tampering, namely by statistics such as Benford's law - however, unlike in voting where results matter immediately and on a large scale, peer reviewers do not typically invest the time to run detailed evaluations of whether the statistics has been tampered with. Scientific work is not treated as adversarial as would be vote manipulation or intelligence work, and it would be a huge waste of time to do so, as there is enough to do with the exploration of the unknown.]