I keep giving Pokemon there respective mega stones and using Protect, to make sure I get a safe mega, nothing happens. When I don't use Protect, my Pokemon dies.
do I have to attack to mega evolve, or am I doing something else wrong?
Select Mega Pokemon
When building your team, make sure you select the Mega form.
Eg. Rather than Sceptile, type in Mega Sceptile
Make sure you give the Pokemon a Mega Stone
Mega Evolve Option
When in battle, the option for Mega Evolution is next to your moves. Tick the box, and your Pokemon should evolve. You get to attack on the same turn that you Mega Evolve, so Mega Evolution does not count as 1 turn.
When you create a team on Pokemon Showdown you should select the Pokemon as Pokemonname-Mega. If you want mega Alakazam for example you select Alakazam-mega as the Pokemon.