How can the searchform.php know if it’s used on a registered sidebar id ‘sidebar-1’ or ‘sidebar-2’?

This should never be a path you try to follow. Widgets should always behave the same way wherever they are placed. If you need two types of searches then you need two different widgets.

If this is a specific per client theme you can style it differently based on sidebar, but even in such a type of project anything which is more than CSS changes will be a surprising thing for the client when he will try to make changes to the theme, and to the developer that will come after you.