It actually depends on the site. If you are playing on Party Poker, then all you have to do is get dealt a hand and your rake counts.
Paradise Poker and some other sites are different. You actually have to play in the hand to get the rake. Furthermore, it is a ratio of your players contribution to that particular pot that determines how much you get from the rake. From their website….
A New Member’s contribution to a “rake” shall be determined by multiplying the quotient obtained when dividing the actual amount to a hand contributed by the New Member by the total bet of each hand, by the total “rake” of the hand in question. For example, if the Real New Member’s contribution to the hand is five Dollars ($5.00) and the total bet in the hand is twenty Dollars ($20.00) and the “rake” of the hand in question is one Dollar ($1.00), the Real New Member’s contribution to the rake will be twenty five cents ($0.25).