How to confirm that a bitcoin transaction is confirmed and success? Coming from ethereum background, I am used to the underlying ethereum tx concept where tx id is not available (returns null) until it is being mined. And after the tx is being mined it have three status which are pending, success and failure, which refers to the transaction state.

Is this the same as bitcoin as I could not see the state of transaction in bitcoin. I can't find any status of the transaction in txid of api returns (i use insight api). How could i ensure that the transaction is in pending/complete state and how can i ensure that the transaction is success or failure. I am thinking of checking 6 confirmations but I don't think that this is a "safe" and proper way as confirmation numbers varies.

To summarize 
1) How do i ensure that a transaction is in pending or completed state
2) How do i ensure that a transaction is in success or failure state after completed.

What I did in ethereum to confirm the transaction is completed and success: 
1) Keep looping and call the txid api every x seconds to get tx detail until it returns non-null object
2) if it returns an object, i can check the status (which is success or failure) to confirm that the transaction is success.

How it is done in bitcoin way?

Sample output of insights api tx:

{
    "txid": "",
    "version": 2,
    "locktime": 0,
    "vin": [
        ...
    ],
    "vout": [
       ...
    ],
    "blockhash": "0000000000000000000586ebc988140383fd557f9bbc09ca0ac10cff2cb0fafd",
    "blockheight": 525860,
    "confirmations": 9,
    "time": 1528080051,
    "blocktime": 1528080051,
    "valueOut": 3.27637624,
    "size": 290,
    "valueIn": 3.27737624,
    "fees": 0.001
}
Bitcoin transactions do not have a failure state, unlike ethereum. They are either mined, or they are not.

In general, a transaction should be considered final when:


It is included in a block, let's say with block number n
There are 5 blocks after this (current height >= n+5)


You don't really even need to loop every second. You can use the zmq feature of Bitcoin Core, or one of the numerous websocket APIs, or just poll for new blocks every 10 minutes. Once you see your tx in a block, you have one confirmation. Then, you simply need to check the next blocks to make sure they build upon the block with your tx.