Determining whether or not a pineapple is ripe is a bit more challenging than with some other fruits.
Pineapples are somewhat unique among fruit in that they stop ripening the minute they are harvested. This is because their sweetness comes from starches that they get from the base of the plant. Once they are removed from the plant, their access to these starches is cut off and the ripening process comes to a halt.  Because of that, you can't buy a pineapple that is not ripe at the store and expect it to ripen with time. Instead, they need to be ripe and ready to eat when you buy them.
Here are some of the most effective ways to tell whether or not a pineapple is ripe:
1. Smell the base of the pineapple. You should be able to smell a subtle pineapple smell from the base. If you can't smell anything, it means the pineapple is not ripe. On the other hand, if it smells like vinegar or acetone, it means that it has started to rot. 
2. Look for a pineapple that has green, fresh leaves at the crown. The body of the fruit itself should be firm with a slight amount of give. Any sign of mushiness means that it has begun to rot. Likewise, if it is super hard to the touch and doesn't give at all, it probably is not ripe. 
3. Look at the color of pineapple. While green pineapples can sometimes be ripe and delicious, they are more likely to be unripe. You should play it safe by looking for a pineapple that has at least a little bit of yellow or gold coloring. Because pineapples ripen from the base upward, the further up the pineapple the yellow color goes, the more even the flavor will be throughout the entire pineapple. Beware, however, of reddish colored pineapples since they are usually overripe. 
Here is a great video that discusses other ways to tell whether or not a pineapple is ripe: