To elaborate on Paparazzi's answer, you can calculate the odds of a card being dealt next by dividing the number of cards you wish to know the chance of coming by all remaining unknown cards (including those in the deck and those in other players' hands). So if you have a suited hand and one card of that suit has come on the flop, the chance of getting another of that suit on the turn is:
[# cards of our suit] / [# cards unknown]
= 10 (there are 13 cards of our suit, but 3 have already been dealt) / 47 (there are 52 cards in the deck, but 5 we already know - 3 on the board and 2 in our hand)
= 10 / 47
= 0.21276595... (around 21%)
You'll notice that this first part of the calculation confirms the 2-4 rule - we have 10 "outs" to get a 4th card of our suit on the turn, so our odds of doing this are roughly 10 * 2 = 20%.
We then need to calculate the chances of hitting a 5th card of our suit on the river in exactly the same way:
[# cards of our suit] / [# cards unknown]
= 9 (there are 13 cards of our suit, but 4 have now been dealt) / 46 (there are 52 cards in the deck, but 6 we already know - 4 on the board and 2 in our hand)
= 9 / 46
= 0.19565217... (around 19.5%)
So finally to calculate the probability of both events happening (hitting a card of our suit on the turn and the river), we multiple these two probabilities together:
(10 / 47) * (9 / 46)
= 0.21276595... * 0.19565217...
= 0.04162812... (around 4%)