How do I connect this sensor so that I can count it's pulses.
Too many different ways: first, you need to decide if you want to polling or interrupt. Polling is easy but is very sensitive to loop timing. Interrupt frees up the mcu but is a little bit more difficult to program.
With interrupt, you can use an external interrupt, or a port change interrupt, or a timer interrupt.
Without you deciding which approach you would like to try, it is impossible to give you more details.