That's a great question but since I don't have the answer I stay on the safe side
For example I never log from university (I'm a teacher) or other public networks where people might be visiting my site and clicking from the same IP as the one I'm using
Yes, is the simplest way, but it works, especially if you don't have a very big site.
Another way is maybe by tracking cookies.
You click on an ad -> cookie.
When you login to adsense, it will verify the cookies and it will se if you click on the links from your site.
I can confirm that, because I just witnessed a channel with a single $0 click, which corresponds nicely to a visitor in the log file. The IP address is in the same /16 range from which my internet provider gives me my dynamic IP address (different every day, but always in the same range). Essentially it's a false positive: I lose a couple of cents and a little reputation with Google.
You can't really think that Google would zero out earnings from 65,534 IPs just because you happens to login from one of them? Many AdSense publishers would go out of business if they did such a thing because many web sites mainly serve their local community.
I login from different networks when I'm on the road and never observed a decline in earnings because of it.
It's most probably a cookie thing. Very seriously doubt it is by IP.
what if you login from a different computer in another state within the US and also make 1 click on your ad?
Hmm, there are only 50 different states so I don't see how that could turn into a sustainable business model.
Seriously, why do you need to know this? You can assume that Google has a variety of automated tools and filters in place to watch for invalid clicks. They've been doing this for several years now and you can assume they've gotten very good at it. Isn't that enough?
The most effective methods are often the simplest :D
I suspect they use a combination of things, including IP address. Remember, Google does almost everything by algorithm and automation. Very little manual intervention (at least at the first stages) So with Google, it's all about analyzing patterns.