Ideally it needs someone famous to sing it, love songs are a good idea, and if you can get in a movie then you are on to a winner. Pretty boys or girls to sing the song is a big help too and a very commercial and current production and sound.
Another way is to write a song that is so controversial it gets banned from airplay, TV broadcast etc and that ensures a top place. The Sex Pistols are a good example of a band that did this and long before them Serge Gainsbourg and Jane Birkin hit the top spot with Je T'aime. Paul McCartney managed the same with a political number - Give Ireland Back to the Irish.
Controversy of any type and sex will sell a song.
I got a song of mine - You're a Liar, Nicky Wire - banned from a shop in the capital of Wales, that got it signed to Crai Records for the Taffia EP and it then got a rave review in the NME so I got part of the way there myself.
References to drugs are another good way of getting banned. The Shamen had a number one with Ebeneezer Goode with its reference to E's being "good."
The song should also have a catchy hook and be easily memorable too.
Fame and controversy are the main ingredients to guarantee success.