How did Apple know that Flash was going to become obsolete?
Apple didn't predict Flash's death, but it sped it up. Steve Jobs kept Flash off the iPhone because it was insecure and drained the battery fast. That opened the door for better, more efficient options like HTML5.