Justin Timberlake highlighted these complications when he took a ballot selfie (since removed) while voting early in Memphis. In this case, it's not even an old law that makes what he did illegal. Tennessee passed a law this year forbidding the use of "a mobile electronic or communication device" for "telephone conversations, recording, or taking photographs or videos while inside the polling place." Though, the law permits the use of phones for "informational purposes to assist the voter in making election decisions."
While that law is new, many weren't written with the digital age in mind and there's sometimes a lack of clarity regarding ballot selfies. NBC reports that Iowa, Montana, Michigan, New York, Nevada, Pennsylvania, South Dakota, Texas, Wisconsin, and 17 other states don't currently allow ballot selfies. A similar map put together by the Associated Press and USA Today says many of those same states, including Montana and Michigan, do allow selfies.