Symptoms
Unable to access Manage Site Realms form with error:
"Specified cast is not valid"
Diagnoses
Looking through the following tables:
[K2].[Identity].[ClaimRealm]
[K2].[Identity].[ClaimRealmIssuer]
there were realms which were not mapped to any issuer.
Resolution
After running a SQL script to insert new entries in the [K2].[Identity].[ClaimRealmIssuer] to include the mapping, this was fixed.