Do not overcook shrimp - they will get tough and rubbery.
Place in a pot with just enough water to barely cover shrimp. Salt or season water, if desired.
As the water begins to heat, the shrimp will begin to change color. Stir them around so that all are exposed to the hot water and equally done.
They should be done in about 2 minutes. Drain immediately and cover with ice water so that they don't continue to cook.
They are done when the backs begin to lift from the shrimp a little. You can see it happening as the cooking shrinks the shrimp a little. Do not devein before cooking - take the vein out when peeling.
Also, if you have a recipe that calls for raw shrimp, peel the shrimp and boil the shells to make broth. Use that instead of water.