This happens either when you have put all the pieces in their right places or when there are pieces you cannot play with any more because the time or the count of allowed faults for the entire game or for some single pieces has run out. Read the Getting started section for information about various game types.
You have wonthe game when every piece is at its correct place. However, you will also get a score and perhaps a place in the highscore list when you have got pieces left.
You will receive points for
You will lose points when trying to put a piece in the wrong place (not in easy mode).
The scoring is highly dependant on the difficulty level you set in the starting dialog. Generally, you get more points in the higher levels, but if you do wrong, you lose more points, too.