The preposition por fuse to pela (por + a), pelas (por +as), pelo (por + o), pelos (por + os) in front of the definite article, see 4.1.1.
There is a context where por and para is often confused and used in a wrong way, although the distinction is easy to understand. If the motive of an action is to be described, it is por, if we describe the goal of an action, it is para.
1) O faz por ela.
He does it because of her.
He does it instead of her.
2) O faz para ela.
He does it for her.
Por corresponds in general to because / instead and para to for.
The problem is that this basic logic is not alway easy to see at first glance.
Gostaríamos de agradecer pelo convite.
We want to say thank you for the invitation.
In Portuguese the invitation is the reason / motive and por is used. It is true that the invitation is the reason they say thank you, the invitation is the event that triggers this action. However in English it is for. Actually they thank them because of the invitation.
Sometimes there is no logic at all.
For one moment, everbody remained in silence.
wrong: Para um momento, todos ficaram em silêncio.
correct: Por um momento, todos ficaram em silêncio.
The following tables shows some possible translations.
por because / for / because of / due to
Por motivos pessoais não pude chegar para o início do curso.
For personal reasons I couldn't take part in the course from the beginning.
Morreu no domingo por causas ainda desconhecidas.
He died for unknown reasons.
Eles conquistaram suas terra por esforço próprio.
They conquered their land by their own effort.
Por razões pessoais, terei de sair antes.
For personal reasons I have to go earlier.
Muito barulho por nada.
Much Ado about Nothing.
por with, of
No nosso país, as lojas de artigos em segunda-mão ainda se contam pelos dedos.
In our country the second hand shops can be counted with the fingers.
A menina calou-se por medo.
The girl kept silent of fear.
In a passive sentence, where the subject is the goal of the event / action the executor of the action can be added with by. In Portuguese we use por in this context.
O fogo foi aceso por ele.
The fire was ignited by him.
The reader may found that the whole analysis doesn't make any sense, because there are no stable rules. However this is exactly what the author of these lines has been telling from the very beginning of this chaper. The best thing to do is to read, and here (!), some novels. That's why we provide them.
A cidade foi destruída por um terremoto.*
The city has been destroyed by the earthquake.
O trabalho é feito por ele.
The work is done by him.
* It could be argued that foi has to be translated with was destroyed, simple past. This would be true for any other roman language, but not for Portuguese, see 9.2.
A aversão por políticos tradicionais explica em parte a popularidade de Trump.
The aversion against traditional politician explains in part the popularity of Donald Trump.
Aqui ainda existe a preferência por nomes tradicionais.
Here there still exists a preference for traditional names.
A simpatia por outras criaturas é um princípio natural.
The sympathy for other species is innate.
Há um enorme entusiasmo por todos os tipos de energia renovável.
There is a big enthousiasm for all types of renewable energies.
por wird gar nicht übersetzt
Embora um celerado, tinha por costume nunca roubar, nem matar, crianças, velhos e mulheres.
Although he was a criminal he had the habit of never rob or kill children, older people or women.