There are some, rather complicated, rules that can help you understand where to put the stress. But do not rely on them too much, because there are many exceptions. It is better to try to "feel" the music of the language and to add the stress naturally.