I have an account with Google & Facebook. Login IDs for them both are same (same gmail id).
When logging into StackOverflow using either of Google or Facebook logins would link to same account.
How does that work?
Stackoverflow likely uses an internal id after you log into the site. Then (after logging in) you can merge the other IDs.
If you sign in using the alternate ID and never merged them then they appear as separate accounts, even if the user is actually the same human.
Here is SO's source code for OpenID. Let me know if you dig up something interesting, the folks at StackExchange write great code you can learn from