Unless you give financial institutions a reason to doubt you, most will simply take your word for it. You'll need to show a proof of address, though, and a residence permit is usually not sufficient for that.
But I have seen cases where banks have analysed data about a client and questioned their residence, for example by looking at mailing address, phone number, IP addresses (where you log in from), transaction patterns (where you use your card, where you send money to/from), and how your address appears in outgoing and incoming first-party transaction to/from other financial institutions (if it's country A with one bank and country B with another, that's something a bank can notice).
Where you may also run into issues is ongoing
due diligence. If you claim tax residence in Country A but you live in Country B, you may run into issues if the bank requests a copy of a utility bill or even your
tax return for Country A.