How is the sample and margin of error calculated in a research?

To calculate a representative sample or its margin of error are activities that require the supervision of a professional statistician. However, nowadays there are websites, apps and tools that help in estimating these values. One that we recommend is http://www.raosoft.com/samplesize.html. .
Keep in mind, nonetheless, that the evaluation of a statistician is important to determine the level of reliability of a research sample.