Button Mashing is often used when a character's strength is being tested often during Quick Time Events or there is some other direct struggle between players like Arm Wrestling in the Monster Hunter series. Button mashing is often replaced by Joystick Waggling is largely analogous, but focuses on the use of a joystick or analog stick of some kind.
The most common way to mash buttons when playing on a console is to place the controller down on a flat surface, usually a table or the players lap, and place one finger on the button the player wishes to mash. Then, the player moves their entire hand up and down, resulting in a number of quick hits and mimicking an arcade style set up. Also the thumb can be used, it is put on all of the buttons that can be reached and moved around to push buttons. For less demanding button mashing segments, many players just hold the controller and press the button normally. Yet another technique is to wrap a piece of fabric (which the player usually takes from his shirt) and continually move his/her finger across the button using a wiping motion, which reduces friction and generates many quick presses rapidly. Two fingers can also be used alternately, usually the index and middle fingers, to generate many button presses without overexerting one finger.
Some games choose to contextualize the Button Mashing and create immersion by having the minigame or quick time event last for an extended period of time so that the player's finger begins to fatigue. This is most commonly used in strength training minigames such as the weight lifting in Grand Theft Auto: San Andreas and No More Heroes, and the workouts in The Warriors. It can also be used to amplify a sense of desperation in a dramatic situation such as the hallway crawl in Metal Gear Solid 4 and the knife pull in Modern Warfare 2.