However, when it comes to redistribution, how does R1 decide whether
to redistribute its own static route, or to advertise the one learnt
from R2 via OSPF?
One key concept about redistribution: Redistribution happens from the routing table, not from the given dynamic routing protocol's "topology database" (different terms for the various protocols).
To redistribute a route learned from one protocol into another routing protocol's "information exchange mechanism", that route first has to make it into the (local) routing table. And and yes, in THIS context, "static" and "connected" are as good as any other routing protocol (even "stronger", see below).
Once redistributed, for example via OSPF, it is then up to the other routers to decide what they make of this information. They'll decide themselves if they want to promote this information to their routing table, or if they have conflicting, more specific or superior information, for example from other routing protocols such as eigrp, bgp, rip, even static or connected. However, all of them will pass on the original information via the given routing protocol to the other routers.
What makes "stronger" routing information is up to the manufacturer or the admin. This information is not passed on via any routing protocol. Cisco calls this metric "administrative distance", and it has a set of default values, which may be overridden by the admin.
And now for the actual answer:
Even if superseded by a "stronger" route (locally on the given router that has both a static AND learned from OSPF), the information about such a route (in case of OSPF: an "external route") is passed on to the other routers in the Autonomous System. So R1 from your example will do this:
- keep its own static route in its routing table.
- forward (via OSPF) the neighbor's OSPF External route (generated/originated on R2, because R2 has "redistribute static") to its other neighbors, so they may learn that this network is reachable via R2. Like this, the information is distributed across the entire AS.
- (if also configured to "redistribute static") R1 will generate an additional "OSPF external" route, so other routers in the AS may learn that this network is also reachable via R1, and the neighbors will pass on the information through the AS.
The other routers in the AS will now learn that there are two ASBRs (R1 and R2) in their AS announcing the reachability of that possibly same external network. If they have packets to forward towards that network, it is up their discretion (read: how they choose to populate their own routing table, based on the information they learned via OSPF) which path they will choose.
So, in OSPF, the passing-on of information from the topology database is independent of the given router's local routing table.