If I were a boy/If she were here/if it were to happen ..
If starts off a conditional sentence as in > If you like it / if I give you...
But, we use "were" to show that that condition cannot be fulfilled .Its not so much as about something in the past , but rather the impossibility / unlikelihood of it happening.
If I were a boy > She cant be a boy
If you were here> You cant because you are somewhere else noe .
If it were to happen ,.> it didn't happen , you just want to make a point if it happened.
If it/she/they /you >> were ( for singular and plural pronouns )