Understanding RAG: How LLMs Access External Knowledge