That's not quite right. Every time you flip the coin there is a 0.5 chance of it being heads, so if you flip 1000 coins, then the expected value is 500, but that doesn't mean it actually has to be this value.
However, the more the coin deviates from the expected values, the higher the chance the coin is weighted. This chance can be determined with the chi-squared test, and if a coin came up with 1000 heads, this test would determine that there is a very low chance of the coin being unbiased.
The lottery thing is right though. It shows you how unlikely you are to win.