I have seen different micro controllers have different output file formats for flashing like 8051 has .hex file format, some have .out file format some have .s12 format and etc. What are the factors on which this output file format depends like the controller architecture or it is up to the micro controller manufacturer to choose the format he wants to flash into the controllers?
The file format does not correspond in any way to the µC itself. It just stores the data on the PC for programming software to read. It is this software which is responsible to provide data and instructions in a format suitable for both the programmer hardware and the target device, not the input file. - Analogy: You don't need .docx files for laser printers and .odt files for ink jets; it's just the storage format for the content and the corresponding software makes sure it generates the specific required output from that.
Maybe note that you will probably never see the data that actually gets sent to the µC during programming, nor the data that gets sent to the programmer hardware, because it's not stored in files. - Just like the data stream sent to a printer by the word processor.