Singing being dubbed

I always wondered when i watch an actor or actress, who can't sing, are pretending to do just that in front of live audience as its being filmed. Don't they look or at least feel stupid, knowing its not their voice? How is this done? Do they just memorize the lyrics and move their mouths as if they are singing and the one who is really singing is in the background, or on record or tape in sync with the actor? I wonder how the 'audience' of that film feel knowing this, as they are 'singing' in a night club or wherever? Rita gets away with up to a point cause she dances with the song and she is a dancer. BTW, for a dancer she was pretty hefty looking...seems all that dancing exercise hadn't helped her in that department. I wonder how she would have looked as far as weight had she not been a dancer? LOL