If I understand properly SHA256 algorithm starts with a string that throughout a mathematical operation over such string gives a result that must satisfy that result<target, i.e H(x)=y<target, where H(·) is such operation, 'x' is the string and 'y' the result. Who decides what is the string 'x' to solve?
There is no string.
SHA256 is a calculation that starts with 1 or more binary digits of data and calculates a 256 bit result. For any given input that result will always be the same, and any small change in the input results in an output that is unpredictably different.
In the case of bitcoin, the data that is being used as an input is the 80 bytes block header for which the miner is attempting to complete the proof-of-work. It consists of:
- A 4 byte version number
- A 32 byte hash of the most recently solved block (this is what keeps the miner from getting a head start on his proof of work, and what keeps anyone from being able to modify older blocks without re-performing all the proof-of-work since that block)
- A 32 byte merkle root (This is how the miner proves which transactions are in his block, and the order of those transactions)
- A 4 byte timestamp
- A 4 byte value that represents the current target value
- A 4 byte nonce (incrementing this value is how the miner "modifies the block header" before computing the SHA256 again)
I mean proof of work is all about solve a challenge. Whenever a new block is find, a new challenge is 'put on the table' so that all nodes are trying to solve the same challenge.
Not exactly. The challenge is always there, and is essentially always the same:
"Create a valid block header such that the double SHA256 hash of that header is less than a target value, where the target value is determined by the proper adjustment at the previous adjustment block".
Who puts on the table that new challenge anytime is needed?
Satoshi Nakamoto did when he created the protocol.
Is it decided by the protocol SHA256 based on the last block accepted in the blockchain?
I'm not sure that I understand this question, but in order to be a valid block the challenge does require that the block header include the hash of the last block accepted in the blockchain.