Read their books and pray to them, but be careful not to pray too frequently. Also, once you choose a god who you want to gain favor with, make sure you only worship gods that have a similar alignment. You can't gain favor with both a chaotic and a lawful god at the same time, for example.
The most helpful thing is to 'o'ffer items at their altar though. If you know what kind of materials or objects they like, and are willing to sacrifice them, you can gain favor really quickly. For example, Mortifer really likes scythes.
For spoilers: http://www.attnam.com/wiki/Gods