Fossils can be obtained in several ways: Breaking Sand , Granite or Sandstone Blocks or by converting 100x Bone Dust into a Fossil. When you right-click (Hold, for phones) the fossil there will be an option that says "Restore", click it and it will send you to a screen with a Sliding Puzzle (Must have a free space in your inventory), which you will have to complete before the time runs out to obtain a Rare Fossil Piece. If you fail to complete the Sliding Puzzle, you will obtain 10x Bone Dust from your Ruined Fossil.
Rare Fossil Pieces
Rare fossil pieces can be obtained by restoring Fossils, you'll get a random piece everytime you restore a fossil. These pieces can be assembled in a certain order to form a Unique Fossil. When you assemble a Fossil you complete a star of the "Archaeologist" achievement. (Fossils you have assembled before will not count towards the achievement)
These are all the Rare Fossil Pieces that are currently in the game: