When a transaction is commited (COMMIT), the transaction is written to the transaction log in RAM.
A transaction is written to the transaction log before even changing the page or data as requested by query. This is called write ahead logging (WAL). If SQL Server crashes while a page is being updated in memory WAL ensures that the DB engine can read the transaction log and rollback the transaction. This is an ACID property of a RDBMS.
When a CHECKPOINT occurs (after some time and/or some transactions and other criterias), the transactions between the last CHECKPOINT and the current are written to disk.
A checkpoint flushes dirty pages from buffer to disk. It behaves a little differently for tempdb. A dirty page is one which has changed since being read from disk. This checkpoint process creates a mark in the transaction log up to the point at which transactions have been committed. After a failure, recovery knows that all transactions up to that mark had committed. You can issue checkpoint manually with a TSQL command.
When a BACKUP LOG happens, the datas are written to the MDF file.
No, when backup log happens SQL Server copies transaction log information from the database log file to the disk where you are writing the backup. A backup operation reads data from disk and writes data on disk.
I would like you to read below links
Understanding Logging and recovery in SQL Server Already pointed by Mark
SQL Server 2008 Internals and troubleshooting Book
Transaction Log Architecture and Management