Perfectly competitive firms do not advertise for their own production. Since their products are identical, any advertising for their own product would only increase demand for all other firm's products. Since advertising is an additional cost, this is not worth it to an individual firm in perfectly competitive markets. However, sometimes groups of firms will advertise together for the product. For example, beef producers in the US have a pooled their resources together to create commercials for beef in general. Other agricultural producers will also do this in industrialized markets.
Since firms in monopolistically competitive markets produce slightly different products, they do advertise since successful advertisements will increase the demand for their own products.