That's where the "protocol" comes in; clients have agreed to index and broadcast events, such as notes, follow lists, and profile data, in a predetermined manner. This cooperation is between the client and relay, as they both follow the same protocol.
Here's a fun fact: you can add "tags" to events, providing additional information. You can use this new tag info to create variations of the same kind of event, while other clients can choose to ignore it.
Example of event structure.
https://image.nostr.build/049ae86040c4bbb5ee2334310ed785ba9287d491b0520202493aaa0010925dfe.jpg#m=image%2Fjpeg&dim=1080x1902&blurhash=%5D384Sst%2B00%23UDiTLt7rqW%3DbFl.%252z%3BJ6IovfR*E%24xHxu%3DuX8ENr%3FspR%24WBs%3Bt6j%5DIns%3BxbNZbb.8n%2BRPX7NGrYNuNa%23%3Axa&x=c532b7722ace8e456f86a6496250858012dc3a735b4cd1fd705a9cfa8716e6c8