You receive a Mega Ring shortly after the 3rd gym. With the Mega Ring, you can now activate Mega Stones. There is a different one for each Pokemon, and the name of them is either part of the Pokemon's name or the whole Pokemon's name ending in -ite. Have your Pokemon hold its respective Mega Stone (e.g. Absol holds the Absolite), and in a battle there will be an option to Mega Evolve below it moves. You can also choose a move to use in that turn as well. It will Mega Evolve before everything else in happens in battle (idk about switching, but I assume it has priority over that). Mega Evolutions will only wear off when the battle ends or the Pokemon faints. You are limited to one Mega Evolution per battle.
Hope this helps :)