Note: I am not a lawyer. This is my simple understanding in layman's terms.
A SAFE is an agreement between you and a company that lets you buy company stock at a specific price when a specific event occurs.
When the specified event occurs, you get company stock. The amount of stock you get is equal to the price you paid for the SAFE divided by your personal price per share. Your price per share is the same price that everyone else gets, possibly modified by a valuation cap or a discount.