"The palace has a tower."
Translation:El palacio tiene una torre.
Actually there are rules to determining if a word is masculine or feminine, just like there are rules for our language. However, there also are exceptions that break this rule, which happens to be "torre" in this sentence. The only aid to help in determining the gender of a noun is none other than practice and memorization (I know, I didn't like hearing that either.) But here is a good page on these rather annoying exceptions.