Meaning: done with or employing great care or thoroughness. (Oxford English Dictionary)
The word is made up of two separate words: pain and take.
Pain in this context refers to the difficulty in achieving something rather than a physical suffering.
Take refers to the effort you put in.
Painstaking basically means the ‘difficult effort’ that was taken to achieve something.
The film-makers show the painstaking way that typhus was eradicated from the camps.
The police painstakingly gathered all the evidence.
He was rewarded for his painstakingness in finding a cure for cancer.
In every day English the adjective and the adverb are often used but the noun is rarely used. On the British National Corpus (BNC) website the first two have around 170 entries each, whereas the last has none.