What I want to know is how to figure out whether a sample that was used to generate probabilities was actually representative of the population that was supposed to be sampled. I want to do this 'backwards' so to speak. So for instance let's say that real world stats show that 2 % of the population that has taken Covid vaccines have had side effects. However in the original sample group .2 % showed symptoms - in other words 1/10 the number in the real world. What is the probability in that scenario that the original sample was representative? Extreme case would be that no side effects were noted in the original sample but in the real world 2% showed side effects. I understand size of the original sample size and the 'real world' numbers are necessary to get to the answer I am looking for. I want a general formula that I can plug those any other numbers I need that will spit out the answers.

To put this another way, let's say a poll predicts that a party will win 30 percent of the vote. However the party only wins 25 percent of the vote in the election. How would I calculate whether the original poll was actually representative of the actual voting public? Or how close (far off) it was?

Thanks in advance for any attention to this.