How long do you usually have to take fertility pills to get pregnant?

Depends on age. A young woman will often conceive within 3-4 months of starting fertility pills. In older age groups it can take quite a bit longer.
3-6 cycles is usual. Many factors besides fertility medication go into achieving a succesful pregnancy. In appropriately selected couples, cumulative pregnancy rates with Clomiphene for example are 85% in 3 cycles and around 95% in 6 cycles.