why it works?
Because when checking the signature, only the x-coordinate is checked, and since due to symmetry there are two points with the same X, there are two different private keys that lead to the same solution. To calculate the second possible key, it is enough to take a symmetrical nonce.
With your parameters from the example:
r= 69933057925445156103627311546056983351587171473600111963597898281808348149939
s= 99514802695095857543902537284008490009261385852143431210120625655251582757337
z= 12948693844049826047046411457108709640188688022302896372272988915976703455562
nonce= 76658540346477621248539633331872761318528094222023647613764244410682868036596
nonce_sym = (nonce * (n-1)) % n
priv1 = (modinv(r,n) * ((nonce * s) - z)) % n
print(priv1) #664613997892457936451903530140172288000
priv2 = (modinv(r,n) * ((nonce_sym * s) - z)) % n
print(priv2) #110623181588558332205237110447978292605510900347349684371947434845384786316778