The button is one of the few gaming mechanics of a video game. They act as switches, activating the object they are connected to when pressed. The button's simplest mechanic is opening a door. Buttons can be activated in a variety of ways: jumping on them (if they are big enough), launching projectiles at them, pressing them, etc...
Most buttons are used in puzzles or ways to defeat a boss. Buttons in puzzles have much features. Like acting as a timer activator to reach an entrance towards a goal or else it will finish and will not allow you, requiring a hit by an object if it's out of reach and putting objects as well as yourself on it to add weight to get something activated. In boss fights, it's simply lure it into the button to do some damage to it, getting ammo/weapon, making it dozed off or just opening a way to escape it if the boss isn't meant for fighting against. In Garry's Mod, it is used to activate the user's invention or door.
The button is similar to levers and keypads but the keypad is not entirely the same as it only requires a code to open a door or activate something. However, the lever is basically the same but it is physically different.