The most common way of doing this is when someone is
sued for
patent infringement. The
defendant would argue that the patent was invalid because of
prior art, and therefore unenforceable.
A patent is really nothing more than a grant of a legal right to sue people practising the technology (or invention) without the consent of the inventor/assignee.
If someone really wanted to go to the time and expense of having an issued patent found to be invalid and unenforceable, one could provoke an infringement and then deal with the prior art issues . . . . .
If the patent had not yet issued (so I guess this would apply to the alleged "pending applications" which are on the heels of the issued patent), anyone can file a "Protest" with the USPTO under 37 CFR 1.291. This protest can include any information that in the protestor's opinion would make the grant of a patent "improper" - which it would be if there was relevant prior art out there.