Because mampara is a feminine noun and atril is a masculine noun. In Spanish, nouns have grammatical gender, and the article must match:
There is not always a logical reason from the meaning alone; it is just part of learning the noun. That said, mampara ends in -a, so feminine is not surprising. Atril ends in a consonant, so you simply have to learn that it is masculine.
The accent marks show the correct stress.
Without the written accent, Spanish spelling rules would suggest a different stress pattern. So the accent marks are necessary.