The most common artifical sweeteners are compounds like aspartame and acesulfame k. They are not sugars, so your body cannot mistake them for sugars. They are chemical compounds that can give a sensation of sweetness (because they can activate the sweetness receptors on your tongue). Their caloric value is zero or close to zero, so they can't make you gain weight.
However many diet sodas such as diet coke contain other compounds that do have calories so you can gain weight when you drink them. But of course, you will gain less weight because you're not drinking all the sugar that is in regular non-diet sodas.
Artificial sweeteners have other drawbacks, some people claim that they can lead to health problems. Aspartame in particular has been implicated in health problems of people who suffer from phenylketonuria and it is recommended not to drink large amounts of of anything that contains aspartame. Also, aspartame, tends to break down when heated, so it is not recommended for use in cooking or in hot drinks.