How block explorer technology works?
blk.dat files contain blocks data in raw format. Also a leveldb index is maintained that helps to quickly lookup blocks/utxo. You can find the details here and here.

Blockexplorers will not directly read these files. It is not safe for multiple process to access leveldb at the same time (blockexplorer and bitcoin node  process). Here is a brief summary of what a blockexplorer will do:


Create tables having indexes to store blocks/transactions/addresses
Do RPC calls/ listen to callbacks to bitcoind to get latest data 
Store fetched data into tables 
Goto 2. 


Most of the commonly used blockexplorers are forked from the below opensource  code:


insight
bitcoin abe