These occur in highly competitive auctions, such as:
part opp you opp
1S 2H 2S 3H
The double is used as an invitational bid. Partner is expected to either bid 4S with a maximum, 3S with a minimum or pass for penalties.
A direct bid by partner of 3S is not invitational--- just competitive.
NOTE: The maximal double is used in its original form only when the opponents have given you no room to make a game try. Thus, in 1S-2D-2S-3D; 3H would be the game try (nothing about hearts) and double would be for penalty.