How do you know if an insignificant P value is because of chance error or because the sample size of the data is too small? I have always thought that an insignificant P value is the product of chance causing variation in the data. However when I was watching a talk on a study, the presenter mentioned how the insignificant P value meant that the sample size of the data was too small to make any conclusions rather the being the product of chance error. How can you tell if an insignificant P value is caused chance error or small sample size then?

There are two main types of error: Type I error, where we reject the null hypothesis despite it being true, and Type II error, where we fail to reject the null hypothesis even though it is false. The probability of getting a Type I error, conditioned on the null hypothesis being true is called $\alpha$, and $1-\alpha$ is the sensitivity of the test. The probability of getting a Type II error, conditioned on the null hypothesis being false, is called $\beta$, and $1-\beta$ is the specificity or power of the test. Methods to estimate $\beta$ are called "power analysis".
$\alpha$ can be calculated from the null hypothesis; one of the requirements for a proper null hypothesis is that it is precisely stated enough that $\alpha$ is known. Calculating $\beta$, however, requires a precise alternative hypothesis; an alternative hypothesis that consists of merely saying that the null is false is not enough. For instance, if the null hypothesis is $\mu =0$, then we would get different $\beta$ for an alternative hypothesis of $\mu = 1$ versus an alternative hypothesis of $\mu = 2$.
How much a parameter differs from the null hypothesis is the effect size (this is often further qualified as "true effect" to distinguish it from "observed effect", with the former being the difference in the actual parameter, while the latter is the difference in the statistic measured from the sample). The main factors affecting power are sample size and effect size. The larger these factors are, the higher the power. For a small sample sizes, a failure to reject the null can be caused the small sample size, the null being true, or chance. But as the sample gets larger, the probability of failure to reject being due to chance gets smaller and smaller, and it becomes easier to draw conclusions.
Since the actual effect size is unknown, we can't know for certain what the power is. But we can, given bound on the effect size, give bounds on the power. For instance, if a drug killing one in a million people who take it is an acceptable risk, we can ask "Given an effect size of one in a million, what's the probability that a drug trial would find no statistical significant difference in fatality rates of those who took the drug?"
