The OP states: "player A is thinking, players B and C fold, player D also folds supposing it is over, and then player A says he is still there. Neither the dealer nor the other players saw A had still his cards".
There are several problems with A's behavior here:
1: He didn't keep his cards visible but rather "hidden behind his chips" and "neither the dealer nor other players saw A's cards". See 2017 TDA Rules #2 and #25-C.
2: He silently let substantial action occur to his left, not speaking up to protect his action until after 3 players have folded to his left. See 2017 TDA Rules, #2, and #43-B.
3: Also we're told A was "counting his chips" rather than following the action, again a violation of Rule #2.
While D also had some culpability here by not following the action and "folding thinking he won", SA has occurred to the left of a skipped player and in such situations Rule 43-B requires the TD to fully assess the situation. Rule 43-B requires the TD to determine 1) if A had reasonable time to act and if so 2) How to treat A's hand. If a good case cannot be made for why A could not respond to D's bet (while both Player B and C could) OR even speak up until 3 players had folded behind him he's likely to have a dead hand at many venues.
There was a very interesting discussion at Summit VIII about guidelines that can be used for Rule 1 decisions. One of the most frequently-mentioned standards was "what decision will most support good play in the future", and "what decision will be most educational for all players at the table". It's very much in the interest of the game to make sure players keep their cards visible, follow the action, protect their right to act, and speak up immediately if skipped.