How Transformer Models Work: Understanding Attention and Neural Networks in AI