With your nose! Most melons are fragrant when ripe- so put your nose right up to the stem end. (But bear in mind that a cold melon will not be fragrant). If you push the blossom end it should yield slightly.
If you buy a melon that is under ripe, don't cut into it. Let it sit at room temperature for 3-4 days and it will become softer and sweeter.