Rules concerning long vowel sounds
As with many aspects of English, there are no "rules", but there are some "guidelines".
The main guideline has to do with "open" and "closed" syllables. An "open" syllable is one that ends with a vowel, while a "closed" syllable ends with a consonant. So "brazen" breaks into syllables as "bra zen", while "flagrant" breaks into "fla grant".
When an syllable is "open" the vowel usually adopts the "long" pronunciation, while if it's "closed" it's usually a "short" pronunciation. Of course, this being English, there are exceptions (an obvious one being the word "bra" vs the "bra" syllable in "brazen").
A kind of rider to this guideline is that when a word ends with a vowel, then consonant, then a trailing "e" (as with "rare", eg), the first vowel is (usually) "long" (and the trailing "e" is silent).
There are other caveats to this "guideline" that I've no doubt forgotten since I studied this stuff in the 3rd and 4th grade. There is most certainly a more authoritative description online somewhere.
And of course I've skipped over the "guidelines" you'd need to determine where syllables are separated. Ie, if the breaks are "flag rant" and "braz en" then the pronunciations would be different. And this is a harder nut to crack, starting from zero.