They are influenced by a variety of factors, the most basic of which is the demographic information—such as age, gender and location—from your profile and activity. Facebook also uses the pages you and your friends like; information from your Facebook and Instagram profile; and places you check in using Facebook.
As you might expect, “Information is valuable. Advertisers, including many political campaigns, pay Facebook to show their ads to specific demographic groups. The labels Facebook assigns to its users help campaigns more precisely target a particular audience.”
Facebook explains how they determine your ad preferences: “We use information from a few different sources to figure out which ads might be relevant and useful to you. Things like your Facebook profile information, activity on Facebook and interactions with businesses can all influence the ads you see.”
So if you want more control on the ads you see on Facebook go to your Facebook ad preferences page after you log on and click on Interests – be sure to click More (to the right) and See More (below.) Under Hobbies and Activities you may find how your political and religious view are perceived by the Facebook algorithm. While you are on that page click Edit Profile to delete or clarify information you might not want Facebook to know about you. If you don’t like what you see, they “give you the controls to influence future ads.” You have more control over ads if you give feedback right from the ad (is the ad useful? – why am I seeing it? – and hide ad). You can also review and adjust your ad settings.