I have a trouble with the eth_getTransactionByHash() method: for some pending transactions it works correctly, but some others there is no response. Although in etherscan this transactions exists. What could be wrong?

Every node on the network has its own pending txn pool. It is not until the pending transaction is mined and is added to a block that the entire network will see the transaction. If you see the transaction on Etherscan as pending but it doesn’t appear when querying Infura, this is because Etherscan’s nodes and Infura’s nodes will sometimes have a different view of the pending pool.

If you send a transaction through an Infura node, each one with it’s own txn pool so we aggregate that pool and provide visibility on this page (replace with your transaction hash). However, it won’t be able to be returned via the regular ETH API until it is in a block.