It varies by game, but there are three common methods.
Most often it is a button sequence entered at the title screen or during play — hold or tap specific buttons in a set order. Another common approach is a dedicated cheats menu, usually tucked under Options in the main menu, where you toggle things on and off.
The third route is a cheat cartridge such as a GameShark or Action Replay, which loads codes before the game boots. Check your game's region matches the code set, or nothing will happen.