it's pretty simple:
publishing:
get the relay lists of people tagged in an event you are going to publish for a client, and publish them to them
fetching:
using the same relay lists, when searching for posts from a user, query the relays in this list
it's not hella scalable but while we are not yet in a stage where high accessibility of paid relays is a thing, and relays are relatively underdeveloped because relay devs get all the airtime and relay devs don't really have so much to easily demonstrate, relays should eventually have "peering" arrangements with other relays so they can fetch this stuff, and further, to propagate queries in order to build up maps of the location of content
yes there is a lot behind all that... me personally, i just gotta get my relay project to production level (in a few weeks) then i can start thinking about how to enable such features, and have relays do more of the legwork so clients aren't so much the weakest link in this chain