Basically the simplest rule is that we add -e when the following word begins with a consonant cluster that's hard to pronounce.
This applies to all prepositions (zaimki) ending in a consonant: bez(e), przed(e), z(e), pod(e), nad(e), etc.
Sometimes both forms are used ex: w czwartek vs. we czwartek, w mszy vs. we mszy
Anytime a preposition precedes the pronoun ja (which takes the form mn-) you must add the -e, ex: ze mną, ode mnie, beze mnie, przede mną, etc.
Finally sometimes it is purely based on historical conventions and you just have to memorize it. ex: we Lwowie but w Lwówku Sląskim
At the end of the day whether you add -e or not is not a big deal. Learning Polish can be difficult and this particular issue is at the low end of the totem pole.